Package com.aspectran.core.service
Class AbstractServiceController
- java.lang.Object
-
- com.aspectran.core.service.AbstractServiceController
-
- All Implemented Interfaces:
ServiceController
- Direct Known Subclasses:
AbstractCoreService,QuartzSchedulerService
public abstract class AbstractServiceController extends java.lang.Object implements ServiceController
The Class AbstractServiceController.
-
-
Constructor Summary
Constructors Constructor Description AbstractServiceController(boolean derivable)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidclearDerivedService()protected abstract voiddoPause()protected abstract voiddoPause(long timeout)protected abstract voiddoResume()protected abstract voiddoStart()protected abstract voiddoStop()protected java.lang.ObjectgetLock()java.lang.StringgetServiceName()Returns the name of this service.booleanisActive()Returns whether this service is currently started and active.booleanisBusy()Returns whether this service has any work in progress.protected abstract booleanisDerived()Returns whether this service is derived from another root service.protected voidjoinDerivedService(ServiceController serviceController)voidpause()Pauses the service.voidpause(long timeout)Pauses the service for a specified period of time.voidrestart()Restarts the service.voidrestart(java.lang.String message)Restarts the service.voidresume()Continues the service after it has been paused.voidsetServiceStateListener(ServiceStateListener serviceStateListener)Sets the service state listener.voidstart()Starts the service.voidstop()Stops the service.protected voidwithdrawDerivedService(ServiceController serviceController)
-
-
-
Method Detail
-
getServiceName
public java.lang.String getServiceName()
Description copied from interface:ServiceControllerReturns the name of this service.- Specified by:
getServiceNamein interfaceServiceController- Returns:
- the name of this service
-
setServiceStateListener
public void setServiceStateListener(ServiceStateListener serviceStateListener)
Description copied from interface:ServiceControllerSets the service state listener.- Specified by:
setServiceStateListenerin interfaceServiceController- Parameters:
serviceStateListener- the new service state listener
-
joinDerivedService
protected void joinDerivedService(ServiceController serviceController)
-
withdrawDerivedService
protected void withdrawDerivedService(ServiceController serviceController)
-
clearDerivedService
protected void clearDerivedService()
-
isDerived
protected abstract boolean isDerived()
Returns whether this service is derived from another root service.- Returns:
- whether this service is derived
-
doStart
protected abstract void doStart() throws java.lang.Exception- Throws:
java.lang.Exception
-
doPause
protected abstract void doPause() throws java.lang.Exception- Throws:
java.lang.Exception
-
doPause
protected abstract void doPause(long timeout) throws java.lang.Exception- Throws:
java.lang.Exception
-
doResume
protected abstract void doResume() throws java.lang.Exception- Throws:
java.lang.Exception
-
doStop
protected abstract void doStop() throws java.lang.Exception- Throws:
java.lang.Exception
-
getLock
protected java.lang.Object getLock()
-
start
public void start() throws java.lang.ExceptionDescription copied from interface:ServiceControllerStarts the service.- Specified by:
startin interfaceServiceController- Throws:
java.lang.Exception- if the service control fails
-
restart
public void restart() throws java.lang.ExceptionDescription copied from interface:ServiceControllerRestarts the service.- Specified by:
restartin interfaceServiceController- Throws:
java.lang.Exception- if the service control fails
-
restart
public void restart(java.lang.String message) throws java.lang.ExceptionDescription copied from interface:ServiceControllerRestarts the service.- Specified by:
restartin interfaceServiceController- Parameters:
message- the message to be delivered to the system before restart- Throws:
java.lang.Exception- if the service control fails
-
pause
public void pause() throws java.lang.ExceptionDescription copied from interface:ServiceControllerPauses the service.- Specified by:
pausein interfaceServiceController- Throws:
java.lang.Exception- if the service control fails
-
pause
public void pause(long timeout) throws java.lang.ExceptionDescription copied from interface:ServiceControllerPauses the service for a specified period of time.- Specified by:
pausein interfaceServiceController- Parameters:
timeout- the maximum time to wait in milliseconds.- Throws:
java.lang.Exception- if the service control fails
-
resume
public void resume() throws java.lang.ExceptionDescription copied from interface:ServiceControllerContinues the service after it has been paused.- Specified by:
resumein interfaceServiceController- Throws:
java.lang.Exception- if the service control fails
-
stop
public void stop()
Description copied from interface:ServiceControllerStops the service. Destroys any services and resources that are dependent on this service.- Specified by:
stopin interfaceServiceController
-
isActive
public boolean isActive()
Description copied from interface:ServiceControllerReturns whether this service is currently started and active.- Specified by:
isActivein interfaceServiceController- Returns:
- true, if the service is active; false otherwise
-
isBusy
public boolean isBusy()
Description copied from interface:ServiceControllerReturns whether this service has any work in progress.- Specified by:
isBusyin interfaceServiceController- Returns:
- true, if this service is busy; false otherwise
-
-