org.jvnet.hk2.component
Interface RunLevelListener


@Contract
public interface RunLevelListener

Implementations of RunLevelService are encouraged to use this contract for publishing RunLevel events.

Instances of classes implementing this contract can be registered into the habitat to be informed of events of RunLevelServices within the same habitat.

Note that RunLevelService implementations may be asynchronous, so RunLevelListeners should be thread safe. Additionally, you are discouraged from performing lengthy operations in the listener since that may impact the performance of the RunLevelService calling the listener on the same thread.

All RunLevelListeners get called for all RunLevel events on the same habitat. It is therefore the caller's responsibility to distinguish the RunLevelState(s) of their interest.

Since:
3.1
Author:
Jeff Trent

Method Summary
 void onCancelled(RunLevelState<?> state, int previousProceedTo)
          Called when an asynchronous RunLevelService implementation's proceedTo() operation has been interrupted with a new proceedTo() call.
 void onError(RunLevelState<?> state, ServiceContext context, java.lang.Throwable error, boolean willContinue)
          Called when a service throws an exception during lifecycle orchestration.
 void onProgress(RunLevelState<?> state)
          Called when the RunLevelService advances in some tangible way.
 

Method Detail

onCancelled

void onCancelled(RunLevelState<?> state,
                 int previousProceedTo)
Called when an asynchronous RunLevelService implementation's proceedTo() operation has been interrupted with a new proceedTo() call.

Parameters:
state - the current and new planned state
previousProceedTo - the previousProceedTo state that is being interrupted. This should always be != state.plannedRunLevel

onError

void onError(RunLevelState<?> state,
             ServiceContext context,
             java.lang.Throwable error,
             boolean willContinue)
Called when a service throws an exception during lifecycle orchestration.

Parameters:
state - the RunLevelService's state
context - the of the failure (may be null)
error - the error that was caught
willContinue - the flag indicating whether or not the RunLevelService plans to proceed thru to the planned RunLevel state.

onProgress

void onProgress(RunLevelState<?> state)
Called when the RunLevelService advances in some tangible way.

Parameters:
state - the RunLevelService's state


Copyright © 2010 Sun Microsystems, Inc.. All Rights Reserved.