Package org.jboss.msc.service
Class DelegatingServiceController<S>
java.lang.Object
org.jboss.msc.service.DelegatingServiceController<S>
- All Implemented Interfaces:
ServiceController<S>,Value<S>
A service controller which delegates to another service controller.
- Author:
- Richard Opalka
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jboss.msc.service.ServiceController
ServiceController.Mode, ServiceController.State -
Constructor Summary
ConstructorsConstructorDescriptionDelegatingServiceController(ServiceController<S> delegate) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(LifecycleListener listener) Add a service lifecycle listener.Deprecated.awaitValue(long time, TimeUnit unit) Deprecated.booleancompareAndSetMode(ServiceController.Mode expected, ServiceController.Mode newMode) Compare the current mode againstexpected; if it matches, change it tonewMode.Deprecated.protected ServiceController<S>Get the ServiceController delegate.getMode()Get the service controller's current mode.getName()Deprecated.Get this service's parent service, ornullif there is none.Get the service.Get the service container associated with this controller.Get the reason why the last start failed.getState()Get the current service controller state.Deprecated.getValue()Deprecated.missing()Get the names of all missing values this service require.provides()Get the names of all values this service provide.voidremoveListener(LifecycleListener listener) Remove a lifecycle listener.requires()Get the names of all values this service require.voidretry()Retry a failed service.voidChange the service controller's current mode.
-
Constructor Details
-
DelegatingServiceController
Construct a new instance.- Parameters:
delegate- the controller to delegate to
-
-
Method Details
-
getDelegate
Get the ServiceController delegate.- Returns:
- ServiceController delegate
-
getParent
Get this service's parent service, ornullif there is none.- Specified by:
getParentin interfaceServiceController<S>- Returns:
- the parent service or
nullif this service has no parent
-
getServiceContainer
Get the service container associated with this controller.- Specified by:
getServiceContainerin interfaceServiceController<S>- Returns:
- the container
-
getMode
Get the service controller's current mode.- Specified by:
getModein interfaceServiceController<S>- Returns:
- the controller mode
-
compareAndSetMode
Compare the current mode againstexpected; if it matches, change it tonewMode. The return value istruewhen the mode was matched and changed.- Specified by:
compareAndSetModein interfaceServiceController<S>- Parameters:
expected- the expected modenewMode- the new mode- Returns:
trueif the mode was changed
-
setMode
Change the service controller's current mode. Might result in the service starting or stopping. The mode may only be changed if it was not already set toServiceController.Mode.REMOVE. Calling this method with the controller's current mode has no effect and is always allowed.- Specified by:
setModein interfaceServiceController<S>- Parameters:
mode- the new controller mode
-
getState
Get the current service controller state.- Specified by:
getStatein interfaceServiceController<S>- Returns:
- the current state
-
getService
Get the service.- Specified by:
getServicein interfaceServiceController<S>- Returns:
- the service
- Throws:
IllegalStateException- if the service is not available (i.e. it is not up)
-
requires
Get the names of all values this service require.- Specified by:
requiresin interfaceServiceController<S>- Returns:
- names of required values
-
provides
Get the names of all values this service provide.- Specified by:
providesin interfaceServiceController<S>- Returns:
- names of provided values
-
missing
Get the names of all missing values this service require.- Specified by:
missingin interfaceServiceController<S>- Returns:
- names of missing values
-
addListener
Add a service lifecycle listener.- Specified by:
addListenerin interfaceServiceController<S>- Parameters:
listener- the lifecycle listener
-
removeListener
Remove a lifecycle listener.- Specified by:
removeListenerin interfaceServiceController<S>- Parameters:
listener- the lifecycle listener to remove
-
getStartException
Get the reason why the last start failed.- Specified by:
getStartExceptionin interfaceServiceController<S>- Returns:
- the last start exception, or
nullif the last start succeeded or the service has not yet started
-
retry
public void retry()Retry a failed service. Does nothing if the state is notServiceController.State.START_FAILED.- Specified by:
retryin interfaceServiceController<S>
-
awaitValue
Deprecated.Wait for a service to come up, and then return its value.- Specified by:
awaitValuein interfaceServiceController<S>- Returns:
- the service value
- Throws:
IllegalStateException- if the service is not available (i.e. it was removed or failed)InterruptedException- if the wait operation was interrupted
-
awaitValue
@Deprecated public S awaitValue(long time, TimeUnit unit) throws IllegalStateException, InterruptedException, TimeoutException Deprecated.Wait for a service to come up for a certain amount of time, and then return its value.- Specified by:
awaitValuein interfaceServiceController<S>- Parameters:
time- the amount of time to waitunit- the unit of time to wait- Returns:
- the service value
- Throws:
IllegalStateException- if the service is not available (i.e. it was removed or failed)InterruptedException- if the wait operation was interruptedTimeoutException
-
getAliases
Deprecated.Get other names this service is known as.- Specified by:
getAliasesin interfaceServiceController<S>- Returns:
- the aliases
- See Also:
-
getName
Deprecated.Get the name of this service, if any.- Specified by:
getNamein interfaceServiceController<S>- Returns:
- the name, or
nullif none was specified. - See Also:
-
getValue
Deprecated.Get the service value.- Specified by:
getValuein interfaceServiceController<S>- Specified by:
getValuein interfaceValue<S>- Returns:
- the service value
- Throws:
IllegalStateException- if the service is not available (i.e. it is not up)
-