Class LockableServiceSupport

java.lang.Object
org.apache.activemq.util.ServiceSupport
org.apache.activemq.broker.LockableServiceSupport
All Implemented Interfaces:
BrokerServiceAware, Lockable, org.apache.activemq.Service

public abstract class LockableServiceSupport extends org.apache.activemq.util.ServiceSupport implements Lockable, BrokerServiceAware
Helper class for working with services that requires locking
  • Field Details

  • Constructor Details

    • LockableServiceSupport

      public LockableServiceSupport()
  • Method Details

    • init

      public abstract void init() throws Exception
      Initialize resources before locking
      Throws:
      Exception
    • setUseLock

      public void setUseLock(boolean useLock)
      Description copied from interface: Lockable
      Turn locking on/off on the resource
      Specified by:
      setUseLock in interface Lockable
    • isUseLock

      public boolean isUseLock()
    • setStopOnError

      public void setStopOnError(boolean stopOnError)
      Description copied from interface: Lockable
      Stop the broker if the locker get an exception while processing lock.
      Specified by:
      setStopOnError in interface Lockable
    • isStopOnError

      public boolean isStopOnError()
    • setLocker

      public void setLocker(Locker locker) throws IOException
      Description copied from interface: Lockable
      Set locker to be used
      Specified by:
      setLocker in interface Lockable
      Throws:
      IOException
    • getLocker

      public Locker getLocker() throws IOException
      Throws:
      IOException
    • setLockKeepAlivePeriod

      public void setLockKeepAlivePeriod(long lockKeepAlivePeriod)
      Description copied from interface: Lockable
      Period (in milliseconds) on which Locker.keepAlive() should be checked
      Specified by:
      setLockKeepAlivePeriod in interface Lockable
    • getLockKeepAlivePeriod

      public long getLockKeepAlivePeriod()
      Specified by:
      getLockKeepAlivePeriod in interface Lockable
    • preStart

      public void preStart() throws Exception
      Overrides:
      preStart in class org.apache.activemq.util.ServiceSupport
      Throws:
      Exception
    • postStop

      public void postStop(org.apache.activemq.util.ServiceStopper stopper) throws Exception
      Overrides:
      postStop in class org.apache.activemq.util.ServiceSupport
      Throws:
      Exception
    • keepLockAlive

      protected void keepLockAlive()
    • stopBroker

      protected void stopBroker()
    • getScheduledThreadPoolExecutor

      public ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()
    • setScheduledThreadPoolExecutor

      public void setScheduledThreadPoolExecutor(ScheduledThreadPoolExecutor clockDaemon)
    • setBrokerService

      public void setBrokerService(BrokerService brokerService)
      Specified by:
      setBrokerService in interface BrokerServiceAware
    • getBrokerService

      public BrokerService getBrokerService()