public interface ComponentLifecycle
The methods are used by the container to start and stop the component, that is, to manage its lifecycle.
Note that the constructor of the component implementation should be
very small, preferably empty. Use the methods initialize(ContainerServices)
and execute() instead.
TODOs:
| Modifier and Type | Method and Description |
|---|---|
void |
aboutToAbort()
Called when due to some error condition the component is about to be forcefully removed
some unknown amount of time later (usually not very much...).
|
void |
cleanUp()
Called after the last functional call to the component has finished.
|
void |
execute()
Called after
initialize(ContainerServices) to tell the component that it has to be ready to accept
incoming functional calls any time. |
void |
initialize(ContainerServices containerServices)
Called to give the component time to initialize itself.
|
void initialize(ContainerServices containerServices) throws ComponentLifecycleException
Called before execute().
In fact, this method might be called quite some time before functional requests
can be sent to the component.
Must be implemented as a synchronous (blocking) call.
containerServices - callback object for services provided by the containerComponentLifecycleExceptionvoid execute()
throws ComponentLifecycleException
initialize(ContainerServices) to tell the component that it has to be ready to accept
incoming functional calls any time.
Examples:
initialize seemed too early
Must be implemented as a synchronous (blocking) call (can spawn threads though).
ComponentLifecycleExceptionvoid cleanUp()
throws AcsJComponentCleanUpEx
AcsJComponentCleanUpExvoid aboutToAbort()
The component should make an effort to die as neatly as possible.
Because of its urgency, this method will be called asynchronously to the execution of any other method of the component.