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 java.lang.Object implements LockService
-
-
Constructor Summary
Constructors Constructor Description MemoryLockService(TechnicalLoggerService loggerService, int lockTimeoutSeconds)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BonitaLocklock(long objectToLockId, java.lang.String objectType, long tenantId)Acquire the lock for the object having type and id in parameters
This method wait for the lock to be availableBonitaLocktryLock(long objectToLockId, java.lang.String objectType, long timeout, java.util.concurrent.TimeUnit timeUnit, long tenantId)Acquire 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, long tenantId)
-
-
-
Constructor Detail
-
MemoryLockService
public MemoryLockService(@Qualifier("platformTechnicalLoggerService") TechnicalLoggerService loggerService, @Value("${bonita.platform.lock.memory.timeout}") int lockTimeoutSeconds)
-
-
Method Detail
-
unlock
public void unlock(BonitaLock lock, long tenantId) throws SLockException
- Specified by:
unlockin interfaceLockService- Throws:
SLockException
-
lock
public BonitaLock lock(long objectToLockId, java.lang.String objectType, long tenantId) 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 interfaceLockServicetenantId- TODO- 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, java.lang.String objectType, long timeout, java.util.concurrent.TimeUnit timeUnit, long tenantId) 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)
-
-