public abstract class LockableServiceSupport extends ServiceSupport implements Lockable, BrokerServiceAware
Modifier and Type | Field and Description |
---|---|
protected BrokerService |
brokerService |
Constructor and Description |
---|
LockableServiceSupport() |
Modifier and Type | Method and Description |
---|---|
BrokerService |
getBrokerService() |
Locker |
getLocker() |
long |
getLockKeepAlivePeriod() |
java.util.concurrent.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 |
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 BrokerService brokerService
public abstract void init() throws java.lang.Exception
java.lang.Exception
public void setUseLock(boolean useLock)
Lockable
setUseLock
in interface Lockable
public boolean isUseLock()
public void setLocker(Locker locker) throws java.io.IOException
Lockable
public Locker getLocker() throws java.io.IOException
java.io.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 java.lang.Exception
ServiceSupport
preStart
in class ServiceSupport
java.lang.Exception
public void postStop(ServiceStopper stopper) throws java.lang.Exception
ServiceSupport
postStop
in class ServiceSupport
java.lang.Exception
protected void keepLockAlive()
protected void stopBroker()
public java.util.concurrent.ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()
public void setBrokerService(BrokerService brokerService)
setBrokerService
in interface BrokerServiceAware
public BrokerService getBrokerService()
Copyright © 2005-2014 Red Hat, Inc.. All Rights Reserved.