Class MemoryLockService

    • Constructor Summary

      Constructors 
      Constructor Description
      MemoryLockService​(int lockTimeoutSeconds)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      BonitaLock lock​(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 available
      BonitaLock tryLock​(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.
      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 Detail

      • MemoryLockService

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

      • lock

        public BonitaLock lock​(long objectToLockId,
                               java.lang.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,
                                  java.lang.String objectType,
                                  long timeout,
                                  java.util.concurrent.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)