Package io.camunda.zeebe.util
Class LockUtil
java.lang.Object
io.camunda.zeebe.util.LockUtil
Utility class for common tasks with
Lock instances.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidRuns the given operation only when the lock has been obtained.static voidRuns the given operation only when the lock has been obtained.static <V> VRuns the given operation only when the lock has been obtained.static <V> VRuns the given operation only when the lock has been obtained.static <V> VRuns the given operation only when the lock has been obtained.
-
Method Details
-
withLock
Runs the given operation only when the lock has been obtained. Locks interruptibly, meaning if the thread is interrupted while waiting for the lock, the runnable is not executed.- Parameters:
lock- the lock to acquirerunnable- the operation to run
-
withLock
Runs the given operation only when the lock has been obtained. Locks interruptibly, meaning if the thread is interrupted while waiting for the lock, the runnable is not executed.- Parameters:
lock- the lock to acquirecallable- the operation to run
-
withLock
Runs the given operation only when the lock has been obtained. Locks interruptibly, meaning if the thread is interrupted while waiting for the lock, the runnable is not executed. If interrupted, calls the error handler.- Parameters:
lock- the lock to acquirerunnable- the operation to runerrorHandler- called if an error occurs during interruption
-
withLock
Runs the given operation only when the lock has been obtained. Locks interruptibly, meaning if the thread is interrupted while waiting for the lock, the runnable is not executed. If interrupted, calls the error handler.- Parameters:
lock- the lock to acquirecallable- the operation to runerrorHandler- called if an error occurs during interruption
-
withLock
Runs the given operation only when the lock has been obtained. Locks interruptibly, meaning if the thread is interrupted while waiting for the lock, the runnable is not executed. If interrupted, calls the error handler.- Parameters:
lock- the lock to acquirecallable- the operation to runerrorHandler- called if an error occurs during interruption
-