org.apache.xbean.kernel
Interface StartStrategy


public interface StartStrategy

The StartStrategy interface is used to assist the kernel in determining how to handle problems that occur while starting a service.

Since:
2.0
Author:
Dain Sundstrom

Method Summary
 void startError(ServiceName serviceName, Throwable startError)
          Handle the start error.
 boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions)
          Determines if the kernel should wait for the unsatified conditions to be satisfied.
 

Method Detail

waitForUnsatisfiedConditions

boolean waitForUnsatisfiedConditions(ServiceName serviceName,
                                     Set conditions)
                                     throws UnsatisfiedConditionsException,
                                            UnregisterServiceException
Determines if the kernel should wait for the unsatified conditions to be satisfied.

Parameters:
serviceName - the name of the service that has the unsatisfied condtions
conditions - the unsatisfied condtions
Returns:
true if the kernel should wait for the conditions to be satisfied; false if the strategy would like silently leave the service in the starting state
Throws:
UnsatisfiedConditionsException - the the strategy would like to leave the service in the starting state and throw an exception the caller
UnregisterServiceException - if the strategy would like to ignore the unsatisfied conditions and continue to destry the service

startError

void startError(ServiceName serviceName,
                Throwable startError)
                throws UnregisterServiceException,
                       Exception
Handle the start error. The strategy can rethrow the exception, throw an UnregisterServiceException, or return. If this method rethrows the exception, the service will be destroyed and the exception will be thrown to the caller. If an UnregisterServiceException is thrown, the kernel will unregister the service and rethrow Throwable.getCause(). If this method returns without throwing an exception, the kernel will pass the exception to the service monitor for processing and leave the service in the starting state.

Parameters:
serviceName - the name of the service that has the error
startError - the Exception or Error
Throws:
UnregisterServiceException - if the strategy would like the service to be destroyed and unregistered
Exception - if the strategy would like to destroy the service and throw the exception to the caller


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.