public class MemoryLockService extends Object implements LockService
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
debugEnabled |
protected int |
lockTimeout |
protected TechnicalLoggerService |
logger |
protected static String |
SEPARATOR |
| Constructor and Description |
|---|
MemoryLockService(TechnicalLoggerService logger,
int lockTimeout,
int lockPoolSize) |
| Modifier and Type | Method and Description |
|---|---|
protected StringBuilder |
getDetailsOnLock(long objectToLockId,
String objectType,
long tenantId) |
protected ReentrantLock |
getLockAndPutItInMap(String key) |
protected ReentrantLock |
getLockFromKey(String key) |
protected BonitaLock |
internalTryLock(long objectToLockId,
String objectType,
long timeout,
TimeUnit timeUnit,
long tenantId) |
BonitaLock |
lock(long objectToLockId,
String objectType,
long tenantId)
Acquire the lock for the object having type and id in parameters
This method wait for the lock to be available |
protected ReentrantLock |
removeLockFromMapIfNotUsed(String key) |
BonitaLock |
tryLock(long objectToLockId,
String objectType,
long timeout,
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. |
void |
unlock(BonitaLock bonitaLock,
long tenantId) |
protected static final String SEPARATOR
protected final TechnicalLoggerService logger
protected final int lockTimeout
protected final boolean debugEnabled
public MemoryLockService(TechnicalLoggerService logger, int lockTimeout, int lockPoolSize)
lockTimeout - timeout to obtain a lock (in seconds)lockPoolSize - the size of the lock poolprotected ReentrantLock getLockAndPutItInMap(String key)
protected ReentrantLock removeLockFromMapIfNotUsed(String key)
public void unlock(BonitaLock bonitaLock, long tenantId)
unlock in interface LockServicepublic BonitaLock tryLock(long objectToLockId, String objectType, long timeout, TimeUnit timeUnit, long tenantId)
LockServicetryLock in interface LockServiceprotected BonitaLock internalTryLock(long objectToLockId, String objectType, long timeout, TimeUnit timeUnit, long tenantId)
public BonitaLock lock(long objectToLockId, String objectType, long tenantId) throws SLockException
LockServicelock in interface LockServicetenantId - TODOSLockException - when we were unable to lock due to an unexpected errorprotected StringBuilder getDetailsOnLock(long objectToLockId, String objectType, long tenantId)
protected ReentrantLock getLockFromKey(String key)
Copyright © 2019 Bonitasoft S.A.. All rights reserved.