Lifecycle interface that implements the
state transition rules for Lifecycle#start() and
Lifecycle#stop()
| Modifier and Type | Field and Description |
|---|---|
| private final List | lifecycleListeners
The list of registered LifecycleListeners for event notifications. |
| private static final Log | |
| private static final StringManager | |
| private volatile LifecycleState | state
The current state of the source component. |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addLifecycleListener(LifecycleListener
The listener to add listener)Implements org. Add a LifecycleEvent listener to this component. |
| public final synchronized void | |
| protected abstract void | |
| public LifecycleListener[] | findLifecycleListeners()
Implements org. Get the life cycle listeners associated with this life cycle. |
| protected void | fireLifecycleEvent(String
Event type type, Object Data associated with event. data)Allow sub classes to fire |
| public LifecycleState | getState()
Implements org. Obtain the current state of the source component. |
| public String | getStateName()
Implements org. Obtain a textual representation of the current component state. |
| public boolean | Returns: true if the exception will be re-thrown, otherwise
falseWill a |
| private void | |
| public final synchronized void | |
| protected abstract void | |
| private void | |
| public void | removeLifecycleListener(LifecycleListener
The listener to remove listener)Implements org. Remove a LifecycleEvent listener from this component. |
| protected synchronized void | setState(LifecycleState
The new state for this component state)Provides a mechanism for sub-classes to update the component state. |
| protected synchronized void | setState(LifecycleState
The new state for this component state, Object The data to pass to the associated data)Lifecycle eventProvides a mechanism for sub-classes to update the component state. |
| private synchronized void | |
| public void | setThrowOnFailure(boolean
true if the exception should be re-thrown,
otherwise falseConfigure if a |
| public final synchronized void | start()
Implements org. Prepare for the beginning of active use of the public methods other than property getters/setters and life cycle methods of this component. |
| protected abstract void | startInternal()
Sub-classes must ensure that the state is changed to
|
| public final synchronized void | stop()
Implements org. Gracefully terminate the active use of the public methods other than property getters/setters and life cycle methods of this component. |
| protected abstract void | stopInternal()
Sub-classes must ensure that the state is changed to
|
| lifecycleListeners | back to summary |
|---|---|
| private final List<LifecycleListener> lifecycleListeners The list of registered LifecycleListeners for event notifications. | |
| log | back to summary |
|---|---|
| private static final Log log | |
| sm | back to summary |
|---|---|
| private static final StringManager sm | |
| state | back to summary |
|---|---|
| private volatile LifecycleState state The current state of the source component. | |
| throwOnFailure | back to summary |
|---|---|
| private boolean throwOnFailure | |
| LifecycleBase | back to summary |
|---|---|
| public LifecycleBase() | |
| addLifecycleListener | back to summary |
|---|---|
| public void addLifecycleListener(LifecycleListener listener) Implements org. Doc from org. Add a LifecycleEvent listener to this component.
| |
| destroy | back to summary |
|---|---|
| public final synchronized void destroy() throws LifecycleException Implements org. Doc from org. Prepare to discard the object. The following
| |
| destroyInternal | back to summary |
|---|---|
| protected abstract void destroyInternal() throws LifecycleException Sub-classes implement this method to perform any instance destruction required.
| |
| findLifecycleListeners | back to summary |
|---|---|
| public LifecycleListener[] findLifecycleListeners() Implements org. Doc from org. Get the life cycle listeners associated with this life cycle.
| |
| fireLifecycleEvent | back to summary |
|---|---|
| protected void fireLifecycleEvent(String type, Object data) Allow sub classes to fire | |
| getState | back to summary |
|---|---|
| public LifecycleState getState() Implements org. Doc from org. Obtain the current state of the source component.
| |
| getStateName | back to summary |
|---|---|
| public String getStateName() Implements org. Doc from org. Obtain a textual representation of the current component state. Useful
for JMX. The format of this string may vary between point releases and
should not be relied upon to determine component state. To determine
component state, use | |
| getThrowOnFailure | back to summary |
|---|---|
| public boolean getThrowOnFailure() Will a
| |
| handleSubClassException | back to summary |
|---|---|
| private void handleSubClassException(Throwable t, String key, Object... args) throws LifecycleException | |
| init | back to summary |
|---|---|
| public final synchronized void init() throws LifecycleException Implements org. Doc from org. Prepare the component for starting. This method should perform any
initialization required post object creation. The following
| |
| initInternal | back to summary |
|---|---|
| protected abstract void initInternal() throws LifecycleException Sub-classes implement this method to perform any instance initialisation required.
| |
| invalidTransition | back to summary |
|---|---|
| private void invalidTransition(String type) throws LifecycleException | |
| removeLifecycleListener | back to summary |
|---|---|
| public void removeLifecycleListener(LifecycleListener listener) Implements org. Doc from org. Remove a LifecycleEvent listener from this component.
| |
| setState | back to summary |
|---|---|
| protected synchronized void setState(LifecycleState state) throws LifecycleException Provides a mechanism for sub-classes to update the component state.
Calling this method will automatically fire any associated
| |
| setState | back to summary |
|---|---|
| protected synchronized void setState(LifecycleState state, Object data) throws LifecycleException Provides a mechanism for sub-classes to update the component state.
Calling this method will automatically fire any associated
| |
| setStateInternal | back to summary |
|---|---|
| private synchronized void setStateInternal(LifecycleState state, Object data, boolean check) throws LifecycleException | |
| setThrowOnFailure | back to summary |
|---|---|
| public void setThrowOnFailure(boolean throwOnFailure) Configure if a
| |
| start | back to summary |
|---|---|
| public final synchronized void start() throws LifecycleException Implements org. Doc from org. Prepare for the beginning of active use of the public methods other than
property getters/setters and life cycle methods of this component. This
method should be called before any of the public methods other than
property getters/setters and life cycle methods of this component are
utilized. The following
| |
| startInternal | back to summary |
|---|---|
| protected abstract void startInternal() throws LifecycleException Sub-classes must ensure that the state is changed to
| |
| stop | back to summary |
|---|---|
| public final synchronized void stop() throws LifecycleException Implements org. Doc from org. Gracefully terminate the active use of the public methods other than
property getters/setters and life cycle methods of this component. Once
the STOP_EVENT is fired, the public methods other than property
getters/setters and life cycle methods should not be used. The following
LifecycleState#FAILED then the
three events above will be fired but the component will transition
directly from LifecycleState#FAILED to
LifecycleState#STOPPING, bypassing
LifecycleState#STOPPING_PREP
| |
| stopInternal | back to summary |
|---|---|
| protected abstract void stopInternal() throws LifecycleException Sub-classes must ensure that the state is changed to
| |