private class ServiceControllerImpl.StopContextImpl extends java.lang.Object implements StopContext
| Modifier and Type | Field and Description |
|---|---|
private long |
startNanos |
private ServiceControllerImpl.ContextState |
state |
| Modifier | Constructor and Description |
|---|---|
private |
StopContextImpl(long startNanos) |
| Modifier and Type | Method and Description |
|---|---|
void |
asynchronous()
Call within the service lifecycle method to trigger an asynchronous lifecycle action.
|
void |
complete()
Call when either synchronous or asynchronous lifecycle action is complete.
|
void |
execute(java.lang.Runnable command)
Execute a task asynchronously using the MSC task executor.
|
ServiceController<?> |
getController()
Get the associated service controller.
|
long |
getElapsedTime()
Get the amount of time elapsed since the start or stop was initiated, in nanoseconds.
|
private ServiceControllerImpl.ContextState state
private final long startNanos
public void asynchronous()
throws java.lang.IllegalStateException
LifecycleContextLifecycleContext.complete() method on this interface.asynchronous in interface LifecycleContextjava.lang.IllegalStateException - if called twice in a rowpublic void complete()
throws java.lang.IllegalStateException
LifecycleContextcomplete in interface LifecycleContextjava.lang.IllegalStateException - if called twice in a rowpublic ServiceController<?> getController()
LifecycleContextgetController in interface LifecycleContextpublic void execute(java.lang.Runnable command)
LifecycleContext
Note: This method should not be used for executing tasks that may block,
particularly from within a service's Service.start(StartContext) or Service.stop(StopContext)
methods. See the Service class javadoc for further details.
execute in interface java.util.concurrent.Executorexecute in interface LifecycleContextcommand - the command to executepublic long getElapsedTime()
LifecycleContextgetElapsedTime in interface LifecycleContext