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 long
startNanos
private ServiceControllerImpl.ContextState
state
-
Constructor Summary
Constructors Modifier Constructor Description private
StopContextImpl(long startNanos)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
state
private ServiceControllerImpl.ContextState state
-
startNanos
private final long startNanos
-
-
Method Detail
-
asynchronous
public void asynchronous() throws java.lang.IllegalStateException
Description copied from interface:LifecycleContext
Call 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:
asynchronous
in interfaceLifecycleContext
- Throws:
java.lang.IllegalStateException
- if called twice in a row
-
complete
public void complete() throws java.lang.IllegalStateException
Description copied from interface:LifecycleContext
Call when either synchronous or asynchronous lifecycle action is complete.- Specified by:
complete
in interfaceLifecycleContext
- Throws:
java.lang.IllegalStateException
- if called twice in a row
-
getController
public ServiceController<?> getController()
Description copied from interface:LifecycleContext
Get the associated service controller.- Specified by:
getController
in interfaceLifecycleContext
- Returns:
- the service controller
-
execute
public void execute(java.lang.Runnable command)
Description copied from interface:LifecycleContext
Execute 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 javadoc
for further details.- Specified by:
execute
in interfacejava.util.concurrent.Executor
- Specified by:
execute
in interfaceLifecycleContext
- Parameters:
command
- the command to execute
-
getElapsedTime
public long getElapsedTime()
Description copied from interface:LifecycleContext
Get the amount of time elapsed since the start or stop was initiated, in nanoseconds.- Specified by:
getElapsedTime
in interfaceLifecycleContext
- Returns:
- the elapsed time
-
-