Package org.bonitasoft.engine.lock
Class MemoryLockService
java.lang.Object
org.bonitasoft.engine.lock.MemoryLockService
- All Implemented Interfaces:
LockService
@Component
@ConditionalOnSingleCandidate(LockService.class)
public class MemoryLockService
extends Object
implements LockService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAcquire the lock for the object having type and id in parameters
This method wait for the lock to be availableAcquire the lock for the object having type and id in parameters waiting maximum timeout
This method wait for the lock to be available.voidunlock(BonitaLock lock)
-
Constructor Details
-
MemoryLockService
public MemoryLockService(@Value("${bonita.platform.lock.memory.timeout}") int lockTimeoutSeconds)
-
-
Method Details
-
unlock
- Specified by:
unlockin interfaceLockService- Throws:
SLockException
-
lock
public BonitaLock lock(long objectToLockId, String objectType) throws SLockException, SLockTimeoutException Description copied from interface:LockServiceAcquire the lock for the object having type and id in parameters
This method wait for the lock to be available- Specified by:
lockin interfaceLockService- Returns:
- the lock
- Throws:
SLockException- when we were unable to lock due to an unexpected errorSLockTimeoutException- when we were unable to lock due to a timeout
-
tryLock
public BonitaLock tryLock(long objectToLockId, String objectType, long timeout, TimeUnit timeUnit) throws SLockException Description copied from interface:LockServiceAcquire the lock for the object having type and id in parameters waiting maximum timeout
This method wait for the lock to be available. If it becomes available before the timeout expires the returns the obtained lock, else returns null- Specified by:
tryLockin interfaceLockService- Returns:
- the obtained lock if it has been acquired before the timeout expires or null if the timeout has expired.
- Throws:
SLockException- when we were unable to lock (not because of the timeout)
-