|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.impl.ServiceSupport
public abstract class ServiceSupport
A useful base class which ensures that a service is only initialized once and provides some helper methods for enquiring of its status.
Implementations can extend this base class and implementSuspendableService
in case they support suspend/resume.
Constructor Summary | |
---|---|
ServiceSupport()
|
Method Summary | |
---|---|
protected void |
addChildService(Object childService)
|
protected void |
doResume()
Implementations override this method to support customized suspend/resume. |
protected void |
doShutdown()
Implementations override this method to perform customized shutdown |
protected abstract void |
doStart()
|
protected abstract void |
doStop()
|
protected void |
doSuspend()
Implementations override this method to support customized suspend/resume. |
ServiceStatus |
getStatus()
Returns the current status |
String |
getVersion()
Returns the version of this service |
boolean |
isRunAllowed()
Helper methods so the service knows if it should keep running. |
boolean |
isStarted()
|
boolean |
isStarting()
|
boolean |
isStopped()
|
boolean |
isStopping()
|
boolean |
isSuspended()
|
boolean |
isSuspending()
|
protected boolean |
removeChildService(Object childService)
|
void |
resume()
|
void |
shutdown()
Shutdown the service, which means it cannot be started again. |
void |
start()
Starts the service |
void |
start(boolean startChildren)
|
void |
stop()
Stops the service |
void |
suspend()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServiceSupport()
Method Detail |
---|
public void start() throws Exception
Service
start
in interface Service
Exception
- is thrown if starting failedpublic void start(boolean startChildren) throws Exception
Exception
public void stop() throws Exception
Service
stop
in interface Service
Exception
- is thrown if stopping failedpublic void suspend() throws Exception
Exception
public void resume() throws Exception
Exception
public void shutdown() throws Exception
ShutdownableService
shutdown
in interface ShutdownableService
Exception
- is thrown if shutting down failedpublic ServiceStatus getStatus()
public boolean isStarted()
public boolean isStarting()
public boolean isStopping()
public boolean isStopped()
public boolean isSuspending()
public boolean isSuspended()
public boolean isRunAllowed()
protected abstract void doStart() throws Exception
Exception
protected abstract void doStop() throws Exception
Exception
protected void doSuspend() throws Exception
Exception
protected void doResume() throws Exception
Exception
protected void doShutdown() throws Exception
Exception
protected void addChildService(Object childService)
protected boolean removeChildService(Object childService)
public String getVersion()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |