public abstract class LockableServiceSupport extends ServiceSupport implements Lockable, BrokerServiceAware
Modifier and Type | Field and Description |
---|---|
protected BrokerService |
brokerService |
protected ScheduledThreadPoolExecutor |
clockDaemon |
Constructor and Description |
---|
LockableServiceSupport() |
Modifier and Type | Method and Description |
---|---|
BrokerService |
getBrokerService() |
Locker |
getLocker() |
long |
getLockKeepAlivePeriod() |
ScheduledThreadPoolExecutor |
getScheduledThreadPoolExecutor() |
abstract void |
init()
Initialize resources before locking
|
boolean |
isUseLock() |
protected void |
keepLockAlive() |
void |
postStop(ServiceStopper stopper) |
void |
preStart() |
void |
setBrokerService(BrokerService brokerService) |
void |
setLocker(Locker locker)
Set locker to be used
|
void |
setLockKeepAlivePeriod(long lockKeepAlivePeriod)
Period (in milliseconds) on which
Locker.keepAlive() should be checked |
void |
setScheduledThreadPoolExecutor(ScheduledThreadPoolExecutor clockDaemon) |
void |
setUseLock(boolean useLock)
Turn locking on/off on the resource
|
protected void |
stopBroker() |
addServiceListener, dispose, doStart, doStop, isStarted, isStopped, isStopping, removeServiceListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createDefaultLocker
protected ScheduledThreadPoolExecutor clockDaemon
protected BrokerService brokerService
public LockableServiceSupport()
public abstract void init() throws Exception
Exception
public void setUseLock(boolean useLock)
Lockable
setUseLock
in interface Lockable
public boolean isUseLock()
public void setLocker(Locker locker) throws IOException
Lockable
setLocker
in interface Lockable
IOException
public Locker getLocker() throws IOException
IOException
public void setLockKeepAlivePeriod(long lockKeepAlivePeriod)
Lockable
Locker.keepAlive()
should be checkedsetLockKeepAlivePeriod
in interface Lockable
public long getLockKeepAlivePeriod()
getLockKeepAlivePeriod
in interface Lockable
public void preStart() throws Exception
preStart
in class ServiceSupport
Exception
public void postStop(ServiceStopper stopper) throws Exception
postStop
in class ServiceSupport
Exception
protected void keepLockAlive()
protected void stopBroker()
public ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()
public void setScheduledThreadPoolExecutor(ScheduledThreadPoolExecutor clockDaemon)
public void setBrokerService(BrokerService brokerService)
setBrokerService
in interface BrokerServiceAware
public BrokerService getBrokerService()
Copyright © 2005–2020 FuseSource, Corp.. All rights reserved.