10.3.4. Explicit Pessimistic Locking Example
The following is an example of explicit pessimistic locking that depicts a transaction that runs on one of the cache nodes:
Procedure 10.3. Transaction with Explicit Pessimistic Locking
- When the line
cache.lock(K)
executes, a cluster-wide lock is acquired onK
.tx.begin() cache.lock(K)
- When the line
cache.put(K,V5)
executes, it guarantees success.tx.begin() cache.lock(K) cache.put(K,V5)
- When the line
tx.commit()
executes, the locks held for this process are released.tx.begin() cache.lock(K) cache.put(K,V5) tx.commit()