Package io.ocfl.core.lock
Interface ObjectLock
-
- All Known Implementing Classes:
DbObjectLock
,InMemoryObjectLock
public interface ObjectLock
Extension point that allows the OCFL repository to use any number of different lock implementations so long as they conform to this interface.- See Also:
InMemoryObjectLock
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
doInWriteLock(String objectId, Runnable doInLock)
Executes the code block after securing a write lock on the objectId.<T> T
doInWriteLock(String objectId, Callable<T> doInLock)
Executes the code block after securing a write lock on the objectId.
-
-
-
Method Detail
-
doInWriteLock
void doInWriteLock(String objectId, Runnable doInLock)
Executes the code block after securing a write lock on the objectId. The lock is released after the block completes.- Parameters:
objectId
- id of the objectdoInLock
- block to execute within the lock
-
doInWriteLock
<T> T doInWriteLock(String objectId, Callable<T> doInLock)
Executes the code block after securing a write lock on the objectId. The lock is released after the block completes.- Type Parameters:
T
- return type- Parameters:
objectId
- id of the objectdoInLock
- block to execute within the lock- Returns:
- object
-
-