Class AbstractLocker

    • Field Detail

      • DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL

        public static final long DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL
        See Also:
        Constant Field Values
      • failIfLocked

        protected boolean failIfLocked
      • lockAcquireSleepInterval

        protected long lockAcquireSleepInterval
    • Constructor Detail

      • AbstractLocker

        public AbstractLocker()
    • Method Detail

      • keepAlive

        public boolean keepAlive()
                          throws IOException
        Description copied from interface: Locker
        Used by a timer to keep alive the lock. If the method returns false the broker should be terminated if an exception is thrown, the lock state cannot be determined
        Specified by:
        keepAlive in interface Locker
        Throws:
        IOException
      • setLockAcquireSleepInterval

        public void setLockAcquireSleepInterval​(long lockAcquireSleepInterval)
        Description copied from interface: Locker
        set the delay interval in milliseconds between lock acquire attempts
        Specified by:
        setLockAcquireSleepInterval in interface Locker
        Parameters:
        lockAcquireSleepInterval - the sleep interval in miliseconds
      • getLockAcquireSleepInterval

        public long getLockAcquireSleepInterval()
      • setName

        public void setName​(String name)
        Description copied from interface: Locker
        Set the name of the lock to use.
        Specified by:
        setName in interface Locker
      • setFailIfLocked

        public void setFailIfLocked​(boolean failIfLocked)
        Description copied from interface: Locker
        Specify whether to fail immediately if the lock is already held. When set, the CustomLock must throw an IOException immediately upon detecting the lock is already held.
        Specified by:
        setFailIfLocked in interface Locker
        Parameters:
        failIfLocked - true => fail immediately if the lock is held; false => block until the lock can be obtained (default).