|
Apache Tomcat 7.0.4 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.catalina.util.LifecycleBase
public abstract class LifecycleBase
Base implementation of the Lifecycle interface that implements the
state transition rules for Lifecycle.start() and
Lifecycle.stop()
| Field Summary |
|---|
| Fields inherited from interface org.apache.catalina.Lifecycle |
|---|
AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, DESTROY_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT |
| Constructor Summary | |
|---|---|
LifecycleBase()
|
|
| Method Summary | |
|---|---|
void |
addLifecycleListener(LifecycleListener listener)
Add a LifecycleEvent listener to this component. |
void |
destroy()
Prepare to discard the object. |
protected abstract void |
destroyInternal()
|
LifecycleListener[] |
findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. |
protected void |
fireLifecycleEvent(String type,
Object data)
Allow sub classes to fire Lifecycle events. |
LifecycleState |
getState()
Obtain the current state of the source component. |
String |
getStateName()
Obtain a textual representation of the current component state. |
void |
init()
Prepare the component for starting. |
protected abstract void |
initInternal()
|
void |
removeLifecycleListener(LifecycleListener listener)
Remove a LifecycleEvent listener from this component. |
protected void |
setState(LifecycleState state)
Provides a mechanism for sub-classes to update the component state. |
protected void |
setState(LifecycleState state,
Object data)
Provides a mechanism for sub-classes to update the component state. |
void |
start()
Prepare for the beginning of active use of the public methods of this component. |
protected abstract void |
startInternal()
Sub-classes must ensure that: the Lifecycle.START_EVENT is fired during the execution of
this method
the state is changed to LifecycleState.STARTING when the
Lifecycle.START_EVENT is fired
If a component fails to start it may either throw a
LifecycleException which will cause it's parent to fail to start
or it can place itself in the error state in which case stop()
will be called on the failed component but the parent component will
continue to start normally. |
void |
stop()
Gracefully terminate the active use of the public methods of this component. |
protected abstract void |
stopInternal()
Sub-classes must ensure that: the Lifecycle.STOP_EVENT is fired during the execution of
this method
the state is changed to LifecycleState.STOPPING when the
Lifecycle.STOP_EVENT is fired
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LifecycleBase()
| Method Detail |
|---|
public void addLifecycleListener(LifecycleListener listener)
addLifecycleListener in interface Lifecyclelistener - The listener to addpublic LifecycleListener[] findLifecycleListeners()
findLifecycleListeners in interface Lifecyclepublic void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener in interface Lifecyclelistener - The listener to remove
protected void fireLifecycleEvent(String type,
Object data)
Lifecycle events.
type - Event typedata - Data associated with event.
public final void init()
throws LifecycleException
LifecycleLifecycleEvents will be fired in the following order:
init in interface LifecycleLifecycleException - if this component detects a fatal error
that prevents this component from being used
protected abstract void initInternal()
throws LifecycleException
LifecycleException
public final void start()
throws LifecycleException
LifecycleEvents will be fired in the following order:
LifecycleState.STARTING_PREP.LifecycleState.STARTING
and that the public methods may be used.LifecycleState.STARTED.
start in interface LifecycleLifecycleException - if this component detects a fatal error
that prevents this component from being used
protected abstract void startInternal()
throws LifecycleException
Lifecycle.START_EVENT is fired during the execution of
this methodLifecycleState.STARTING when the
Lifecycle.START_EVENT is fired
LifecycleException which will cause it's parent to fail to start
or it can place itself in the error state in which case stop()
will be called on the failed component but the parent component will
continue to start normally.
LifecycleException
public final void stop()
throws LifecycleException
LifecycleEvents will be fired in the
following order:
LifecycleState.STOPPING_PREP.LifecycleState.STOPPING
and that the public methods may no longer be used.LifecycleState.STOPPED.
stop in interface LifecycleLifecycleException - if this component detects a fatal error
that needs to be reported
protected abstract void stopInternal()
throws LifecycleException
Lifecycle.STOP_EVENT is fired during the execution of
this methodLifecycleState.STOPPING when the
Lifecycle.STOP_EVENT is fired
LifecycleException
public final void destroy()
throws LifecycleException
LifecycleLifecycleEvents will
be fired in the following order:
destroy in interface LifecycleLifecycleException - if this component detects a fatal error
that prevents this component from being used
protected abstract void destroyInternal()
throws LifecycleException
LifecycleExceptionpublic LifecycleState getState()
getState in interface Lifecyclepublic String getStateName()
getStateName in interface Lifecycleprotected void setState(LifecycleState state)
Lifecycle event.
state - The new state for this component
protected void setState(LifecycleState state,
Object data)
Lifecycle event.
state - The new state for this componentdata - The data to pass to the associated Lifecycle event
|
Apache Tomcat 7.0.4 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||