此内容没有您所选择的语言版本。
9.4.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:
tx.begin()
cache.lock(K)
cache.put(K,V5)
tx.commit()
- When the line
cache.lock(K)executes, a cluster-wide lock is acquired onK. - When the line
cache.put(K,V5)executes, it guarantees success. - When the line
tx.commit()executes, the locks held for this process are released.