Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
try {
   acquire lock foo

   ...

   acquire lock bar
   ...

}
finally {
   release all locks
}

Example

Adding an item to a partitioned cache

Code Block

try {
   LockManager lockManager = ...;
   ResourceController controller = ...;

   lockManager.acquire(resourceID);

   controller.put(key, value);
}
finally {
   lockManager.releaseAllLocks()
}