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
    Constructor
    Description
    MemoryLockService(int lockTimeoutSeconds)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    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 lock, long tenantId)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MemoryLockService

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

    • unlock

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

      public BonitaLock lock(long objectToLockId, String objectType, long tenantId) 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
      tenantId - TODO
      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, long tenantId) 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)