public class DelegatingServiceController<S> extends Object implements ServiceController<S>
ServiceController.Mode, ServiceController.State, ServiceController.Substate, ServiceController.Transition
Constructor and Description |
---|
DelegatingServiceController(ServiceController<S> delegate)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(LifecycleListener listener)
Add a service lifecycle listener.
|
void |
addListener(ServiceListener<? super S> listener)
Deprecated.
|
S |
awaitValue()
Deprecated.
|
S |
awaitValue(long time,
TimeUnit unit)
Deprecated.
|
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.
|
protected ServiceController<S> |
getDelegate()
Get the ServiceController delegate.
|
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()
Deprecated.
|
Collection<ServiceName> |
getUnavailableDependencies()
Get the complete list of dependencies that are unavailable.
|
S |
getValue()
Deprecated.
|
void |
removeListener(LifecycleListener listener)
Remove a lifecycle listener.
|
void |
removeListener(ServiceListener<? super S> listener)
Deprecated.
|
void |
retry()
Retry a failed service.
|
void |
setMode(ServiceController.Mode mode)
Change the service controller's current mode.
|
public DelegatingServiceController(ServiceController<S> delegate)
delegate
- the controller to delegate toprotected ServiceController<S> getDelegate()
public ServiceController<?> getParent()
null
if there is none.getParent
in interface ServiceController<S>
null
if this service has no parentpublic ServiceContainer getServiceContainer()
getServiceContainer
in interface ServiceController<S>
public ServiceController.Mode getMode()
getMode
in interface ServiceController<S>
public 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.compareAndSetMode
in interface ServiceController<S>
expected
- the expected modenewMode
- the new modetrue
if the mode was changedpublic void setMode(ServiceController.Mode mode)
ServiceController.Mode.REMOVE
. Calling this method with the controller's
current mode has no effect and is always allowed.setMode
in interface ServiceController<S>
mode
- the new controller modepublic ServiceController.State getState()
getState
in interface ServiceController<S>
@Deprecated public ServiceController.Substate getSubstate()
getSubstate
in interface ServiceController<S>
@Deprecated public S getValue() throws IllegalStateException
getValue
in interface ServiceController<S>
getValue
in interface Value<S>
IllegalStateException
- if the service is not available (i.e. it is not up)@Deprecated public S awaitValue() throws IllegalStateException, InterruptedException
awaitValue
in interface ServiceController<S>
IllegalStateException
- if the service is not available (i.e. it was removed or failed)InterruptedException
- if the wait operation was interrupted@Deprecated public S awaitValue(long time, TimeUnit unit) throws IllegalStateException, InterruptedException, TimeoutException
awaitValue
in interface ServiceController<S>
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
public Service<S> getService() throws IllegalStateException
getService
in interface ServiceController<S>
IllegalStateException
- if the service is not available (i.e. it is not up)public ServiceName getName()
getName
in interface ServiceController<S>
null
if none was specified.public ServiceName[] getAliases()
getAliases
in interface ServiceController<S>
public void addListener(LifecycleListener listener)
addListener
in interface ServiceController<S>
listener
- the lifecycle listener@Deprecated public void addListener(ServiceListener<? super S> listener)
addListener
in interface ServiceController<S>
listener
- the service listenerpublic void removeListener(LifecycleListener listener)
removeListener
in interface ServiceController<S>
listener
- the lifecycle listener to remove@Deprecated public void removeListener(ServiceListener<? super S> listener)
removeListener
in interface ServiceController<S>
listener
- the service listener to removepublic StartException getStartException()
getStartException
in interface ServiceController<S>
null
if the last start succeeded or the service has not yet startedpublic void retry()
ServiceController.State.START_FAILED
.retry
in interface ServiceController<S>
public Set<ServiceName> getImmediateUnavailableDependencies()
getImmediateUnavailableDependencies
in interface ServiceController<S>
public Collection<ServiceName> getUnavailableDependencies()
getUnavailableDependencies
in interface ServiceController<S>
Copyright © 2019 JBoss by Red Hat. All rights reserved.