Class LockManagerImpl
java.lang.Object
org.flowable.common.engine.impl.lock.LockManagerImpl
- All Implemented Interfaces:
LockManager
- Author:
- Filip Hrisafov
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CommandExecutorprotected Stringprotected booleanprotected static final intprotected CommandConfigprotected Durationprotected Stringprotected Durationprotected static final org.slf4j.Logger -
Constructor Summary
ConstructorsConstructorDescriptionLockManagerImpl(CommandExecutor commandExecutor, String lockName, Duration lockPollRate, String engineType) LockManagerImpl(CommandExecutor commandExecutor, String lockName, Duration lockPollRate, Duration forceAcquireAfter, String engineType) -
Method Summary
Modifier and TypeMethodDescriptionbooleanAcquire the lock.booleanacquireLock(Duration lockForceAcquireAfter) Acquire the lock.protected <T> TexecuteCommand(Command<T> command) protected DurationvoidRelease the lock and delete the resources for the lock if needed.voidRelease the lock.voidwaitForLock(Duration waitTime) Wait for the givenwaitTimeto acquire the lock<T> TwaitForLockRunAndRelease(Duration waitTime, Supplier<T> supplier) Wait to acquire a lock, once a lock is acquired execute the supplier and release finally the lock.
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
LOCK_NAME_MAX_LENGTH
protected static final int LOCK_NAME_MAX_LENGTH- See Also:
-
commandExecutor
-
lockName
-
lockPollRate
-
engineType
-
lockCommandConfig
-
hasAcquiredLock
protected boolean hasAcquiredLock -
lockForceAcquireAfter
-
-
Constructor Details
-
LockManagerImpl
public LockManagerImpl(CommandExecutor commandExecutor, String lockName, Duration lockPollRate, String engineType) -
LockManagerImpl
public LockManagerImpl(CommandExecutor commandExecutor, String lockName, Duration lockPollRate, Duration forceAcquireAfter, String engineType)
-
-
Method Details
-
waitForLock
Description copied from interface:LockManagerWait for the givenwaitTimeto acquire the lock- Specified by:
waitForLockin interfaceLockManager- Parameters:
waitTime- the duration to wait before throwing an exception
-
acquireLock
public boolean acquireLock()Description copied from interface:LockManagerAcquire the lock.- Specified by:
acquireLockin interfaceLockManager- Returns:
trueif the lock was acquired,falseotherwise
-
acquireLock
Description copied from interface:LockManagerAcquire the lock. ThelockForceAcquireAfterwill be used to acquire an expired lock- Specified by:
acquireLockin interfaceLockManager- Parameters:
lockForceAcquireAfter- the amount of time after which the lock should be acquired- Returns:
trueif the lock was acquired,falseotherwise
-
releaseLock
public void releaseLock()Description copied from interface:LockManagerRelease the lock.- Specified by:
releaseLockin interfaceLockManager
-
releaseAndDeleteLock
public void releaseAndDeleteLock()Description copied from interface:LockManagerRelease the lock and delete the resources for the lock if needed.- Specified by:
releaseAndDeleteLockin interfaceLockManager
-
waitForLockRunAndRelease
Description copied from interface:LockManagerWait to acquire a lock, once a lock is acquired execute the supplier and release finally the lock.- Specified by:
waitForLockRunAndReleasein interfaceLockManager- Parameters:
waitTime- the duration to wait before throwing an exceptionsupplier- the supplier to be executed once the lock is acquired- Returns:
- the result from the
supplier
-
executeCommand
-
getLockPollRate
-