Class LockManagerImpl
java.lang.Object
org.flowable.common.engine.impl.lock.LockManagerImpl
- All Implemented Interfaces:
LockManager
- Author:
- Filip Hrisafov
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CommandExecutor
protected String
protected boolean
protected static final int
protected CommandConfig
protected Duration
protected String
protected Duration
protected 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 TypeMethodDescriptionboolean
Acquire the lock.boolean
acquireLock
(Duration lockForceAcquireAfter) Acquire the lock.protected <T> T
executeCommand
(Command<T> command) protected Duration
void
Release the lock and delete the resources for the lock if needed.void
Release the lock.void
waitForLock
(Duration waitTime) Wait for the givenwaitTime
to acquire the lock<T> T
waitForLockRunAndRelease
(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:LockManager
Wait for the givenwaitTime
to acquire the lock- Specified by:
waitForLock
in interfaceLockManager
- Parameters:
waitTime
- the duration to wait before throwing an exception
-
acquireLock
public boolean acquireLock()Description copied from interface:LockManager
Acquire the lock.- Specified by:
acquireLock
in interfaceLockManager
- Returns:
true
if the lock was acquired,false
otherwise
-
acquireLock
Description copied from interface:LockManager
Acquire the lock. ThelockForceAcquireAfter
will be used to acquire an expired lock- Specified by:
acquireLock
in interfaceLockManager
- Parameters:
lockForceAcquireAfter
- the amount of time after which the lock should be acquired- Returns:
true
if the lock was acquired,false
otherwise
-
releaseLock
public void releaseLock()Description copied from interface:LockManager
Release the lock.- Specified by:
releaseLock
in interfaceLockManager
-
releaseAndDeleteLock
public void releaseAndDeleteLock()Description copied from interface:LockManager
Release the lock and delete the resources for the lock if needed.- Specified by:
releaseAndDeleteLock
in interfaceLockManager
-
waitForLockRunAndRelease
Description copied from interface:LockManager
Wait to acquire a lock, once a lock is acquired execute the supplier and release finally the lock.- Specified by:
waitForLockRunAndRelease
in 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
-