Class LockManagerImpl

    • Field Detail

      • LOGGER

        protected static final org.slf4j.Logger LOGGER
      • lockName

        protected String lockName
      • lockPollRate

        protected Duration lockPollRate
      • engineType

        protected String engineType
      • hasAcquiredLock

        protected boolean hasAcquiredLock
      • lockForceAcquireAfter

        protected Duration lockForceAcquireAfter
    • Method Detail

      • waitForLock

        public void waitForLock​(Duration waitTime)
        Description copied from interface: LockManager
        Wait for the given waitTime to acquire the lock
        Specified by:
        waitForLock in interface LockManager
        Parameters:
        waitTime - the duration to wait before throwing an exception
      • acquireLock

        public boolean acquireLock()
        Description copied from interface: LockManager
        Acquire the lock.
        Specified by:
        acquireLock in interface LockManager
        Returns:
        true if the lock was acquired, false otherwise
      • acquireLock

        public boolean acquireLock​(Duration lockForceAcquireAfter)
        Description copied from interface: LockManager
        Acquire the lock. The lockForceAcquireAfter will be used to acquire an expired lock
        Specified by:
        acquireLock in interface LockManager
        Parameters:
        lockForceAcquireAfter - the amount of time after which the lock should be acquired
        Returns:
        true if the lock was acquired, false otherwise
      • releaseAndDeleteLock

        public void releaseAndDeleteLock()
        Description copied from interface: LockManager
        Release the lock and delete the resources for the lock if needed.
        Specified by:
        releaseAndDeleteLock in interface LockManager
      • waitForLockRunAndRelease

        public <T> T waitForLockRunAndRelease​(Duration waitTime,
                                              Supplier<T> supplier)
        Description copied from interface: LockManager
        Wait to acquire a lock, once a lock is acquired execute the supplier and release finally the lock.
        Specified by:
        waitForLockRunAndRelease in interface LockManager
        Parameters:
        waitTime - the duration to wait before throwing an exception
        supplier - the supplier to be executed once the lock is acquired
        Returns:
        the result from the supplier
      • executeCommand

        protected <T> T executeCommand​(Command<T> command)
      • getLockPollRate

        protected Duration getLockPollRate()