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)
handle for various operations after stopping the service (like locking)
|
void |
preStart()
handle for various operations before starting the service (like locking)
|
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, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateDefaultLockerprotected ScheduledThreadPoolExecutor clockDaemon
protected BrokerService brokerService
public LockableServiceSupport()
public abstract void init() throws Exception
Exceptionpublic void setUseLock(boolean useLock)
LockablesetUseLock in interface Lockablepublic boolean isUseLock()
public void setLocker(Locker locker) throws IOException
LockablesetLocker in interface LockableIOExceptionpublic Locker getLocker() throws IOException
IOExceptionpublic void setLockKeepAlivePeriod(long lockKeepAlivePeriod)
LockableLocker.keepAlive() should be checkedsetLockKeepAlivePeriod in interface Lockablepublic long getLockKeepAlivePeriod()
getLockKeepAlivePeriod in interface Lockablepublic void preStart() throws Exception
ServiceSupportpreStart in class ServiceSupportExceptionpublic void postStop(ServiceStopper stopper) throws Exception
ServiceSupportpostStop in class ServiceSupportExceptionprotected void keepLockAlive()
protected void stopBroker()
public ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()
public void setScheduledThreadPoolExecutor(ScheduledThreadPoolExecutor clockDaemon)
public void setBrokerService(BrokerService brokerService)
setBrokerService in interface BrokerServiceAwarepublic BrokerService getBrokerService()
Copyright © 2005–2015 FuseSource, Corp.. All rights reserved.