org.jboss.msc.service
Interface LifecycleContext

All Superinterfaces:
Executor
All Known Subinterfaces:
StartContext, StopContext

public interface LifecycleContext
extends Executor

A context object for lifecycle events.

Author:
David M. Lloyd

Method Summary
 void asynchronous()
          Call within the service lifecycle method to trigger an asynchronous lifecycle action.
 void complete()
          Call when an asynchronous lifecycle action is complete.
 void execute(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.
 

Method Detail

asynchronous

void asynchronous()
                  throws IllegalStateException
Call within the service lifecycle method to trigger an asynchronous lifecycle action. This action will not be considered complete until indicated so by calling a method on this interface.

Throws:
IllegalStateException - if called outside of the main service lifecycle method

complete

void complete()
              throws IllegalStateException
Call when an asynchronous lifecycle action is complete.

Throws:
IllegalStateException - if called before asynchronous() is called, or if the action was already completed

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(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) or Service.stop(StopContext) methods. See the Service class javadoc for further details.

Specified by:
execute in interface Executor
Parameters:
command - the command to execute


Copyright © 2011. All Rights Reserved.