Package com.aspectran.core.service
Class AbstractServiceController
java.lang.Object
com.aspectran.core.service.AbstractServiceController
- All Implemented Interfaces:
ServiceController
- Direct Known Subclasses:
AbstractCoreService
,QuartzSchedulerService
The Class AbstractServiceController.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected abstract void
doPause()
protected abstract void
doPause
(long timeout) protected abstract void
doResume()
protected abstract void
doStart()
protected abstract void
doStop()
protected Object
getLock()
Returns the first created CoreService that holds the ActivityContext.Returns the name of this service.boolean
isActive()
Returns whether this service is currently started and active.boolean
isBusy()
Returns whether this service has any work in progress.protected abstract boolean
Returns whether this service is derived from another root service.protected boolean
isExposable
(String transletName) protected void
joinDerivedService
(ServiceController serviceController) void
pause()
Pauses the service.void
pause
(long timeout) Pauses the service for a specified period of time.void
restart()
Restarts the service.void
Restarts the service.void
resume()
Continues the service after it has been paused.protected void
setExposals
(String[] includePatterns, String[] excludePatterns) protected void
setRootService
(CoreService rootService) void
setServiceStateListener
(ServiceStateListener serviceStateListener) Sets the service state listener.void
start()
Starts the service.void
stop()
Stops the service.protected void
withdrawDerivedService
(ServiceController serviceController)
-
Constructor Details
-
AbstractServiceController
public AbstractServiceController(boolean derivable)
-
-
Method Details
-
getServiceName
Description copied from interface:ServiceController
Returns the name of this service.- Specified by:
getServiceName
in interfaceServiceController
- Returns:
- the name of this service
-
getRootService
Description copied from interface:ServiceController
Returns the first created CoreService that holds the ActivityContext.- Specified by:
getRootService
in interfaceServiceController
- Returns:
- the root service
-
setRootService
-
setServiceStateListener
Description copied from interface:ServiceController
Sets the service state listener.- Specified by:
setServiceStateListener
in interfaceServiceController
- Parameters:
serviceStateListener
- the new service state listener
-
joinDerivedService
-
withdrawDerivedService
-
clearDerivedService
protected void clearDerivedService() -
isExposable
-
setExposals
-
isDerived
protected abstract boolean isDerived()Returns whether this service is derived from another root service.- Returns:
- whether this service is derived
-
doStart
- Throws:
Exception
-
doPause
- Throws:
Exception
-
doPause
- Throws:
Exception
-
doResume
- Throws:
Exception
-
doStop
- Throws:
Exception
-
getLock
-
start
Description copied from interface:ServiceController
Starts the service.- Specified by:
start
in interfaceServiceController
- Throws:
Exception
- if the service control fails
-
restart
Description copied from interface:ServiceController
Restarts the service.- Specified by:
restart
in interfaceServiceController
- Throws:
Exception
- if the service control fails
-
restart
Description copied from interface:ServiceController
Restarts the service.- Specified by:
restart
in interfaceServiceController
- Parameters:
message
- the message to be delivered to the system before restart- Throws:
Exception
- if the service control fails
-
pause
Description copied from interface:ServiceController
Pauses the service.- Specified by:
pause
in interfaceServiceController
- Throws:
Exception
- if the service control fails
-
pause
Description copied from interface:ServiceController
Pauses the service for a specified period of time.- Specified by:
pause
in interfaceServiceController
- Parameters:
timeout
- the maximum time to wait in milliseconds.- Throws:
Exception
- if the service control fails
-
resume
Description copied from interface:ServiceController
Continues the service after it has been paused.- Specified by:
resume
in interfaceServiceController
- Throws:
Exception
- if the service control fails
-
stop
public void stop()Description copied from interface:ServiceController
Stops the service. Destroys any services and resources that are dependent on this service.- Specified by:
stop
in interfaceServiceController
-
isActive
public boolean isActive()Description copied from interface:ServiceController
Returns whether this service is currently started and active.- Specified by:
isActive
in interfaceServiceController
- Returns:
- true, if the service is active; false otherwise
-
isBusy
public boolean isBusy()Description copied from interface:ServiceController
Returns whether this service has any work in progress.- Specified by:
isBusy
in interfaceServiceController
- Returns:
- true, if this service is busy; false otherwise
-