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 Details

    • MemoryLockService

      public MemoryLockService(@Value("${bonita.platform.lock.memory.timeout}") int lockTimeoutSeconds)
  • Method Details

    • unlock

      public void unlock(BonitaLock lock) throws SLockException
      Specified by:
      unlock in interface LockService
      Throws:
      SLockException
    • lock

      public BonitaLock lock(long objectToLockId, String objectType) throws SLockException, SLockTimeoutException
      Description copied from interface: LockService
      Acquire the lock for the object having type and id in parameters
      This method wait for the lock to be available
      Specified by:
      lock in interface LockService
      Returns:
      the lock
      Throws:
      SLockException - when we were unable to lock due to an unexpected error
      SLockTimeoutException - 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: LockService
      Acquire 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:
      tryLock in interface LockService
      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)