S
- the service typepublic interface ServiceController<S> extends Value<S>
Modifier and Type | Interface and Description |
---|---|
static class |
ServiceController.Mode
The controller mode for a service.
|
static class |
ServiceController.State
A possible state for a service controller.
|
static class |
ServiceController.Substate
A fine-grained substate of the more general basic controller
ServiceController.State s. |
static class |
ServiceController.Transition
A transition from one substate to another.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ServiceListener<? super S> serviceListener)
Add a service listener.
|
S |
awaitValue()
Wait for a service to come up, and then return its value.
|
S |
awaitValue(long time,
TimeUnit unit)
Wait for a service to come up for a certain amount of time, and then return its value.
|
boolean |
compareAndSetMode(ServiceController.Mode expected,
ServiceController.Mode newMode)
Compare the current mode against
expected ; if it matches, change it to newMode . |
ServiceName[] |
getAliases()
Get other names this service is known as.
|
Set<ServiceName> |
getImmediateUnavailableDependencies()
Get the complete list of immediate dependencies that are unavailable.
|
ServiceController.Mode |
getMode()
Get the service controller's current mode.
|
ServiceName |
getName()
Get the name of this service, if any.
|
ServiceController<?> |
getParent()
Get this service's parent service, or
null if there is none. |
Service<S> |
getService()
Get the service.
|
ServiceContainer |
getServiceContainer()
Get the service container associated with this controller.
|
StartException |
getStartException()
Get the reason why the last start failed.
|
ServiceController.State |
getState()
Get the current service controller state.
|
ServiceController.Substate |
getSubstate()
Get the current service controller substate.
|
S |
getValue()
Get the service value.
|
void |
removeListener(ServiceListener<? super S> serviceListener)
Remove a service listener.
|
void |
retry()
Retry a failed service.
|
void |
setMode(ServiceController.Mode mode)
Change the service controller's current mode.
|
ServiceController<?> getParent()
null
if there is none.null
if this service has no parentServiceContainer getServiceContainer()
ServiceController.Mode getMode()
boolean compareAndSetMode(ServiceController.Mode expected, ServiceController.Mode newMode)
expected
; if it matches, change it to newMode
. The
return value is true
when the mode was matched and changed.expected
- the expected modenewMode
- the new modetrue
if the mode was changedvoid setMode(ServiceController.Mode mode)
ServiceController.Mode.REMOVE
. Calling this method with the controller's
current mode has no effect and is always allowed.mode
- the new controller modeIllegalStateException
- if the mode given is null
, or the caller attempted to change the
service's mode from ServiceController.Mode.REMOVE
to a different modeServiceController.State getState()
ServiceController.Substate getSubstate()
S getValue() throws IllegalStateException
getValue
in interface Value<S>
IllegalStateException
- if the service is not available (i.e. it is not up)S awaitValue() throws IllegalStateException, InterruptedException
IllegalStateException
- if the service is not available (i.e. it was removed or failed)InterruptedException
- if the wait operation was interruptedS awaitValue(long time, TimeUnit unit) throws IllegalStateException, InterruptedException, TimeoutException
time
- the amount of time to waitunit
- the unit of time to waitIllegalStateException
- if the service is not available (i.e. it was removed or failed)InterruptedException
- if the wait operation was interruptedTimeoutException
Service<S> getService() throws IllegalStateException
IllegalStateException
- if the service is not available (i.e. it is not up)ServiceName getName()
null
if none was specified.ServiceName[] getAliases()
void addListener(ServiceListener<? super S> serviceListener)
serviceListener
- the service listenervoid removeListener(ServiceListener<? super S> serviceListener)
serviceListener
- the service listener to removeStartException getStartException()
null
if the last start succeeded or the service has not yet startedvoid retry()
ServiceController.State.START_FAILED
.Set<ServiceName> getImmediateUnavailableDependencies()
Copyright © 2017 JBoss by Red Hat. All rights reserved.