Class AbstractLifeCycle
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
- All Implemented Interfaces:
LifeCycle
- Direct Known Subclasses:
AbstractContextProvider, AbstractLeakPreventer, AcceptRateLimit, AllowedResourceAliasChecker, BaseHolder, BaseHolder, BaseHolder, ConnectionLimit, ConnectionStatistics, ConnectorServer, ContainerLifeCycle, DebugListener, DebugListener, DebugListener, HouseKeeper, HTTP2Session, MemcachedSessionDataMap, NetworkConnectionLimit, PropertyUserStoreManager, QuicSessionContainer, RequestLogWriter, ScheduledExecutorScheduler, ServletContextHandler.Initializer, ServletContextHandler.Initializer, SessionContainer, SessionTracker, SessionTracker, SessionTracker, SessionTracker, SessionTracker, SessionTracker, Slf4jRequestLogWriter, StopLifeCycle, Sweeper, TimerScheduler, TrailingSlashAliasChecker
@ManagedObject("Abstract Implementation of LifeCycle")
public abstract class AbstractLifeCycle
extends Object
implements LifeCycle
Basic implementation of the life cycle interface for components.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated, for removal: This API element is subject to removal in a future version.static classAn exception, which when thrown bydoStart()will immediately stop the componentNested classes/interfaces inherited from interface LifeCycle
LifeCycle.Listener -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddEventListener(EventListener listener) protected voiddoStart()Method to override to start the lifecycleprotected voiddoStop()Method to override to stop the lifecyclegetState()static StringbooleanisFailed()booleanbooleanbooleanbooleanbooleanbooleanremoveEventListener(EventListener listener) voidsetEventListeners(Collection<EventListener> eventListeners) final voidstart()Starts the component.final voidstop()Stops the component.toString()
-
Field Details
-
STOPPED
-
FAILED
-
STARTING
-
STARTED
-
STOPPING
-
-
Constructor Details
-
AbstractLifeCycle
public AbstractLifeCycle()
-
-
Method Details
-
doStart
Method to override to start the lifecycle- Throws:
AbstractLifeCycle.StopException- If thrown, the lifecycle will immediately be stopped.Exception- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
-
start
-
stop
Description copied from interface:LifeCycleStops the component. The component may wait for current activities to complete normally, but it can be interrupted. -
isRunning
-
isStarted
-
isStarting
public boolean isStarting()- Specified by:
isStartingin interfaceLifeCycle- Returns:
- true if the component is starting.
- See Also:
-
isStopping
public boolean isStopping()- Specified by:
isStoppingin interfaceLifeCycle- Returns:
- true if the component is stopping.
- See Also:
-
isStopped
-
isFailed
-
getEventListeners
-
setEventListeners
-
addEventListener
- Specified by:
addEventListenerin interfaceLifeCycle
-
removeEventListener
- Specified by:
removeEventListenerin interfaceLifeCycle
-
getState
@ManagedAttribute(value="Lifecycle State for this instance", readonly=true) public String getState() -
getState
-
toString
-
LifeCycle.Listenerhas default methods.