Package org.jboss.msc.service
Class ServiceControllerImpl.StopContextImpl
- java.lang.Object
-
- org.jboss.msc.service.ServiceControllerImpl.StopContextImpl
-
- All Implemented Interfaces:
java.util.concurrent.Executor,LifecycleContext,StopContext
- Enclosing class:
- ServiceControllerImpl<S>
private class ServiceControllerImpl.StopContextImpl extends java.lang.Object implements StopContext
-
-
Field Summary
Fields Modifier and Type Field Description private longstartNanosprivate ServiceControllerImpl.ContextStatestate
-
Constructor Summary
Constructors Modifier Constructor Description privateStopContextImpl(long startNanos)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidasynchronous()Call within the service lifecycle method to trigger an asynchronous lifecycle action.voidcomplete()Call when either synchronous or asynchronous lifecycle action is complete.voidexecute(java.lang.Runnable command)Execute a task asynchronously using the MSC task executor.ServiceController<?>getController()Get the associated service controller.longgetElapsedTime()Get the amount of time elapsed since the start or stop was initiated, in nanoseconds.
-
-
-
Field Detail
-
state
private ServiceControllerImpl.ContextState state
-
startNanos
private final long startNanos
-
-
Method Detail
-
asynchronous
public void asynchronous() throws java.lang.IllegalStateExceptionDescription copied from interface:LifecycleContextCall within the service lifecycle method to trigger an asynchronous lifecycle action. This action will not be considered complete until indicated so by calling aLifecycleContext.complete()method on this interface.- Specified by:
asynchronousin interfaceLifecycleContext- Throws:
java.lang.IllegalStateException- if called twice in a row
-
complete
public void complete() throws java.lang.IllegalStateExceptionDescription copied from interface:LifecycleContextCall when either synchronous or asynchronous lifecycle action is complete.- Specified by:
completein interfaceLifecycleContext- Throws:
java.lang.IllegalStateException- if called twice in a row
-
getController
public ServiceController<?> getController()
Description copied from interface:LifecycleContextGet the associated service controller.- Specified by:
getControllerin interfaceLifecycleContext- Returns:
- the service controller
-
execute
public void execute(java.lang.Runnable command)
Description copied from interface:LifecycleContextExecute a task asynchronously using the MSC task executor.Note: This method should not be used for executing tasks that may block, particularly from within a service's
Service.start(StartContext)orService.stop(StopContext)methods. Seethe Service class javadocfor further details.- Specified by:
executein interfacejava.util.concurrent.Executor- Specified by:
executein interfaceLifecycleContext- Parameters:
command- the command to execute
-
getElapsedTime
public long getElapsedTime()
Description copied from interface:LifecycleContextGet the amount of time elapsed since the start or stop was initiated, in nanoseconds.- Specified by:
getElapsedTimein interfaceLifecycleContext- Returns:
- the elapsed time
-
-