Distributed Locks
Cacheonix provides an API for distributed mutual exclusions that allows distributed Java applications to maintain strict consistency by serializing access to shared data. Multiple servers that modify shared resources concurrently may cause interference and data inconsistency. Distributed locks by Cacheonix provide safety of data access, application liveness and simplicity of programming:
- Cacheonix read/write locks ensure safe access to the shared data in the cluster. At most one thread on one server may enter the section of code protected by a distributed write lock. Cacheonix read locks increase apprlication concurrency in the cluster. Applications that are only reading the shared data may execute the section of the code protected by read locks simultaneously.
- Cacheonix guarantees liveness of distributed applications by building on top of its reliable symmetric clustering protocol. Cacheonix seamlessly releases locks held by servers that fail or leave the cluster. Cacheonix prevents application stalling by detecting deadlocks and breaking the deadlocks automatically. Cacheonix supports nested locks.
- Cacheonix makes programming with distributed locks as simple as in a single Java VM. Cacheonix upgrades read locks to write locks when necessary. Cacheonix distributed locks API is as easy to use as java.concurrent.locks and has the same API:
ReadWriteLock readWriteLock = cacheonix.getCluster().getReadWriteLock();
Lock writeLock = readWriteLock.readLock();
writeLock.lock();
try {
// Critical section protected by the write lock
...
} finally {
writeLock.unlock();
}
Next: