Package org.apache.activemq.util
Class ServiceSupport
- java.lang.Object
-
- org.apache.activemq.util.ServiceSupport
-
- All Implemented Interfaces:
Service
- Direct Known Subclasses:
AbstractLocker
,InMemoryJobSchedulerStore
,JobSchedulerImpl
,LockableServiceSupport
,MessageDatabase
,MQTTPacketIdGenerator
,PListStoreImpl
,Scheduler
,TransportServerSupport
,TransportSupport
public abstract class ServiceSupport extends Object implements Service
A helper class for working with services together with a useful base class for service implementations.
-
-
Constructor Summary
Constructors Constructor Description ServiceSupport()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addServiceListener(ServiceListener l)
static void
dispose(Service service)
protected abstract void
doStart()
protected abstract void
doStop(ServiceStopper stopper)
boolean
isStarted()
boolean
isStopped()
boolean
isStopping()
protected void
postStop(ServiceStopper stopper)
handle for various operations after stopping the service (like locking)protected void
preStart()
handle for various operations before starting the service (like locking)void
removeServiceListener(ServiceListener l)
void
start()
void
stop()
-
-
-
Method Detail
-
dispose
public static void dispose(Service service)
-
start
public void start() throws Exception
-
isStarted
public boolean isStarted()
- Returns:
- true if this service has been started
-
isStopping
public boolean isStopping()
- Returns:
- true if this service is in the process of closing
-
isStopped
public boolean isStopped()
- Returns:
- true if this service is closed
-
addServiceListener
public void addServiceListener(ServiceListener l)
-
removeServiceListener
public void removeServiceListener(ServiceListener l)
-
postStop
protected void postStop(ServiceStopper stopper) throws Exception
handle for various operations after stopping the service (like locking)- Throws:
Exception
-
doStop
protected abstract void doStop(ServiceStopper stopper) throws Exception
- Throws:
Exception
-
preStart
protected void preStart() throws Exception
handle for various operations before starting the service (like locking)- Throws:
Exception
-
-