Interface Locker

  • All Superinterfaces:
    org.apache.activemq.Service
    All Known Implementing Classes:
    AbstractLocker, SharedFileLocker

    public interface Locker
    extends org.apache.activemq.Service
    Represents a lock service to ensure that a broker is the only master
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void configure​(PersistenceAdapter persistenceAdapter)
      Optionally configure the locker with the persistence adapter currently used You can use persistence adapter configuration details like, data directory datasource, etc. to be used by the locker
      boolean keepAlive()
      Used by a timer to keep alive the lock.
      void setFailIfLocked​(boolean failIfLocked)
      Specify whether to fail immediately if the lock is already held.
      void setLockable​(LockableServiceSupport lockable)
      A reference to what is locked
      void setLockAcquireSleepInterval​(long lockAcquireSleepInterval)
      set the delay interval in milliseconds between lock acquire attempts
      void setName​(String name)
      Set the name of the lock to use.
      • Methods inherited from interface org.apache.activemq.Service

        start, stop
    • Method Detail

      • keepAlive

        boolean keepAlive()
                   throws IOException
        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
        Throws:
        IOException
      • setLockAcquireSleepInterval

        void setLockAcquireSleepInterval​(long lockAcquireSleepInterval)
        set the delay interval in milliseconds between lock acquire attempts
        Parameters:
        lockAcquireSleepInterval - the sleep interval in miliseconds
      • setName

        void setName​(String name)
        Set the name of the lock to use.
      • setFailIfLocked

        void setFailIfLocked​(boolean failIfLocked)
        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.
        Parameters:
        failIfLocked - true => fail immediately if the lock is held; false => block until the lock can be obtained (default).
      • configure

        void configure​(PersistenceAdapter persistenceAdapter)
                throws IOException
        Optionally configure the locker with the persistence adapter currently used You can use persistence adapter configuration details like, data directory datasource, etc. to be used by the locker
        Parameters:
        persistenceAdapter -
        Throws:
        IOException