org.apache.activemq.broker
Class LockableServiceSupport

java.lang.Object
  extended by org.apache.activemq.util.ServiceSupport
      extended by org.apache.activemq.broker.LockableServiceSupport
All Implemented Interfaces:
BrokerServiceAware, Lockable, Service
Direct Known Subclasses:
DataSourceServiceSupport, KahaDBPersistenceAdapter, org.apache.activemq.leveldb.LevelDBStore

public abstract class LockableServiceSupport
extends ServiceSupport
implements Lockable, BrokerServiceAware

Helper class for working with services that requires locking


Field Summary
protected  BrokerService brokerService
           
 
Constructor Summary
LockableServiceSupport()
           
 
Method Summary
 Locker getLocker()
           
 ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()
           
abstract  void init()
          Initialize resources before locking
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()
           
 
Methods inherited from class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, doStart, doStop, isStarted, isStopped, isStopping, removeServiceListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.broker.Lockable
createDefaultLocker
 

Field Detail

brokerService

protected BrokerService brokerService
Constructor Detail

LockableServiceSupport

public LockableServiceSupport()
Method Detail

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

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

preStart

public void preStart()
              throws Exception
Description copied from class: ServiceSupport
handle for various operations before starting the service (like locking)

Overrides:
preStart in class ServiceSupport
Throws:
Exception

postStop

public void postStop(ServiceStopper stopper)
              throws Exception
Description copied from class: ServiceSupport
handle for various operations after stopping the service (like locking)

Overrides:
postStop in class ServiceSupport
Throws:
Exception

keepLockAlive

protected void keepLockAlive()

stopBroker

protected void stopBroker()

getScheduledThreadPoolExecutor

public ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()

setBrokerService

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


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.