Package org.apache.activemq.broker
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongabstract voidinit()Initialize resources before lockingbooleanbooleanprotected voidvoidpostStop(org.apache.activemq.util.ServiceStopper stopper) voidpreStart()voidsetBrokerService(BrokerService brokerService) voidSet locker to be usedvoidsetLockKeepAlivePeriod(long lockKeepAlivePeriod) Period (in milliseconds) on whichLocker.keepAlive()should be checkedvoidvoidsetStopOnError(boolean stopOnError) Stop the broker if the locker get an exception while processing lock.voidsetUseLock(boolean useLock) Turn locking on/off on the resourceprotected voidMethods inherited from class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, doStart, doStop, isStarted, isStopped, isStopping, removeServiceListener, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.activemq.broker.Lockable
createDefaultLocker
-
Field Details
-
clockDaemon
-
brokerService
-
-
Constructor Details
-
LockableServiceSupport
public LockableServiceSupport()
-
-
Method Details
-
init
Initialize resources before locking- Throws:
Exception
-
setUseLock
public void setUseLock(boolean useLock) Description copied from interface:LockableTurn locking on/off on the resource- Specified by:
setUseLockin interfaceLockable
-
isUseLock
public boolean isUseLock() -
setStopOnError
public void setStopOnError(boolean stopOnError) Description copied from interface:LockableStop the broker if the locker get an exception while processing lock.- Specified by:
setStopOnErrorin interfaceLockable
-
isStopOnError
public boolean isStopOnError() -
setLocker
Description copied from interface:LockableSet locker to be used- Specified by:
setLockerin interfaceLockable- Throws:
IOException
-
getLocker
- Throws:
IOException
-
setLockKeepAlivePeriod
public void setLockKeepAlivePeriod(long lockKeepAlivePeriod) Description copied from interface:LockablePeriod (in milliseconds) on whichLocker.keepAlive()should be checked- Specified by:
setLockKeepAlivePeriodin interfaceLockable
-
getLockKeepAlivePeriod
public long getLockKeepAlivePeriod()- Specified by:
getLockKeepAlivePeriodin interfaceLockable
-
preStart
- Overrides:
preStartin classorg.apache.activemq.util.ServiceSupport- Throws:
Exception
-
postStop
- Overrides:
postStopin classorg.apache.activemq.util.ServiceSupport- Throws:
Exception
-
keepLockAlive
protected void keepLockAlive() -
stopBroker
protected void stopBroker() -
getScheduledThreadPoolExecutor
-
setScheduledThreadPoolExecutor
-
setBrokerService
- Specified by:
setBrokerServicein interfaceBrokerServiceAware
-
getBrokerService
-