Package org.jboss.msc.service
Interface LifecycleContext
-
- All Superinterfaces:
java.util.concurrent.Executor
- All Known Subinterfaces:
StartContext,StopContext
- All Known Implementing Classes:
ServiceControllerImpl.StartContextImpl,ServiceControllerImpl.StopContextImpl
public interface LifecycleContext extends java.util.concurrent.ExecutorA context object for lifecycle events.
-
-
Method Summary
All Methods Instance Methods Abstract 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.
-
-
-
Method Detail
-
asynchronous
void asynchronous() throws java.lang.IllegalStateExceptionCall within the service lifecycle method to trigger an asynchronous lifecycle action. This action will not be considered complete until indicated so by calling acomplete()method on this interface.- Throws:
java.lang.IllegalStateException- if called twice in a row
-
complete
void complete() throws java.lang.IllegalStateExceptionCall when either synchronous or asynchronous lifecycle action is complete.- Throws:
java.lang.IllegalStateException- if called twice in a row
-
getElapsedTime
long getElapsedTime()
Get the amount of time elapsed since the start or stop was initiated, in nanoseconds.- Returns:
- the elapsed time
-
getController
ServiceController<?> getController()
Get the associated service controller.- Returns:
- the service controller
-
execute
void execute(java.lang.Runnable command)
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 javadocfor further details.- Specified by:
executein interfacejava.util.concurrent.Executor- Parameters:
command- the command to execute
-
-