Data replication among different sites is viewed as a way to increase application performance and its data availability. In this paper, we propose an algorithm design for concurrency control and recovery in a middleware architecture called COPLA (Common Object Programmer Library Access). This architecture provides persistent object state replication. The algorithm is based on locks, it is an adaptation of the Optimistic Two Phase Locking (O2PL) protocol to this architecture. The recovery process of this algorithm allows applications to continue (or start) executing transactions at all nodes, even in the node being recovered.