Class LockUtils
java.lang.Object
org.apache.jena.sparql.service.enhancer.impl.util.LockUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
runWithLock
(Lock lock, Callable<T> action) Perform an action which requires acquisition of a lock first.static void
runWithLock
(Lock lock, ThrowingRunnable action) Run an action after locking; eventually the lock is unlocked in a finally blockstatic <T,
L extends Lock>
TrunWithMgmtLock
(L lock, Consumer<? super L> forceUnlock, Duration duration, Callable<T> action) Run this action with a short-lived locked.
-
Constructor Details
-
LockUtils
public LockUtils()
-
-
Method Details
-
runWithLock
Perform an action which requires acquisition of a lock first. An attempt is made to acquire the lock. If this fails then the action is not run. Upon completion of the action (successful or exceptional) the lock is released again. -
runWithLock
Run an action after locking; eventually the lock is unlocked in a finally block -
runWithMgmtLock
public static <T,L extends Lock> T runWithMgmtLock(L lock, Consumer<? super L> forceUnlock, Duration duration, Callable<T> action) Run this action with a short-lived locked. If the lock cannot be acquired within the given time it is considered stale and forcibly unlocked. Subsequently another attempt is made to acquire the lock.
-