Package org.eclipse.jetty.util.component
Interface LifeCycle
- All Known Subinterfaces:
Connector,Handler,HandlerContainer,NetworkConnector,Scheduler,ServletContextHandler.ServletContainerInitializerCaller,SessionCache,SessionDataMap,SessionDataStore,SessionIdManager
- All Known Implementing Classes:
AbstractConnectionFactory,AbstractConnectionPool,AbstractConnector,AbstractConnectorHttpClientTransport,AbstractConnectorHttpClientTransport.ClientSelectorManager,AbstractHandler,AbstractHandler.ErrorDispatchHandler,AbstractHandlerContainer,AbstractHttpClientTransport,AbstractLeakPreventer,AbstractLifeCycle,AbstractLoginService,AbstractNCSARequestLog,AbstractNetworkConnector,AbstractSessionCache,AbstractSessionDataStore,AcceptRateLimit,AppContextLeakPreventer,AsyncDelayHandler,AsyncNCSARequestLog,AsyncRequestLogWriter,AttributeContainerMap,AWTLeakPreventer,BaseHolder,BufferedResponseHandler,CachingSessionDataStore,CompressionPool,ConfigurableSpnegoLoginService,ConnectionLimit,ConnectionStatistics,ConnectorServer,ConnectorStatistics,ConstraintSecurityHandler,ContainerLifeCycle,ContextHandler,ContextHandlerCollection,CustomRequestLog,DebugHandler,DebugListener,DefaultHandler,DefaultSessionCache,DefaultSessionIdManager,DeflaterPool,DetectorConnectionFactory,DOMLeakPreventer,DriverManagerLeakPreventer,DuplexConnectionPool,EatWhatYouKill,ErrorHandler,ErrorPageErrorHandler,ExecutorSizedThreadPool,ExecutorThreadPool,FileSessionDataStore,FilterHolder,GCThreadLeakPreventer,GzipHandler,HandlerCollection,HandlerList,HandlerWrapper,HashLoginService,Holder,HotSwapHandler,HouseKeeper,HttpClient,HttpClientTransportOverHTTP,HttpConnectionFactory,HttpDestination,HttpDestinationOverHTTP,IdleTimeoutHandler,IncludeExcludeConnectionStatistics,InetAccessHandler,InflaterPool,IPAccessHandler,JAASLoginService,Java2DLeakPreventer,JDBCLoginService,JDBCSessionDataStore,KeyStoreScanner,LDAPLeakPreventer,LeakDetector,LeakTrackingByteBufferPool,LeakTrackingConnectionPool,ListenerHolder,LocalConnector,LoginConfigurationLeakPreventer,LowResourceMonitor,LowResourceMonitor.LRMScheduler,ManagedSelector,MonitoredQueuedThreadPool,MovedContextHandler,MovedContextHandler.Redirector,MultiplexConnectionPool,MultiplexHttpDestination,NCSARequestLog,NegotiatingServerConnectionFactory,NetworkTrafficSelectChannelConnector,NetworkTrafficServerConnector,NullSessionCache,NullSessionDataStore,OptionalSslConnectionFactory,PathWatcher,PoolingHttpDestination,PropertyUserStore,PropertyUserStoreManager,ProxyConnectionFactory,ProxyConnectionFactory.ProxyV1ConnectionFactory,ProxyConnectionFactory.ProxyV2ConnectionFactory,QueuedThreadPool,RandomConnectionPool,RequestLogHandler,RequestLogWriter,ReservedThreadExecutor,ResourceHandler,RoundRobinConnectionPool,Scanner,ScheduledExecutorScheduler,ScopedHandler,SecuredRedirectHandler,SecurityHandler,SecurityProviderLeakPreventer,SelectorManager,Server,ServerConnectionStatistics,ServerConnector,ServerConnector.ServerConnectorManager,ServletContextHandler,ServletContextHandler.Initializer,ServletHandler,ServletHolder,SessionHandler,ShutdownHandler,Slf4jRequestLog,Slf4jRequestLogWriter,SpnegoLoginService,SslConnectionFactory,SslContextFactory,SslContextFactory.Client,SslContextFactory.Server,StatisticsHandler,StopLifeCycle,Sweeper,ThreadLimitHandler,TimerScheduler,UserStore,ValidatingConnectionPool,WebAppContext
The lifecycle interface for generic components.
Classes implementing this interface have a defined life cycle defined by the methods of this interface.
Classes implementing this interface have a defined life cycle defined by the methods of this interface.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifeCycleListener(LifeCycle.Listener listener) booleanisFailed()booleanbooleanbooleanbooleanbooleanvoidremoveLifeCycleListener(LifeCycle.Listener listener) voidstart()Starts the component.static voidUtility to start an object if it is a LifeCycle and to convert any exception thrown to aRuntimeExceptionvoidstop()Stops the component.static voidUtility to stop an object if it is a LifeCycle and to convert any exception thrown to aRuntimeException
-
Method Details
-
start
Starts the component.- Throws:
Exception- If the component fails to start- See Also:
-
stop
Stops the component. The component may wait for current activities to complete normally, but it can be interrupted.- Throws:
Exception- If the component fails to stop- See Also:
-
isRunning
boolean isRunning()- Returns:
- true if the component is starting or has been started.
-
isStarted
boolean isStarted()- Returns:
- true if the component has been started.
- See Also:
-
isStarting
boolean isStarting()- Returns:
- true if the component is starting.
- See Also:
-
isStopping
boolean isStopping()- Returns:
- true if the component is stopping.
- See Also:
-
isStopped
boolean isStopped()- Returns:
- true if the component has been stopped.
- See Also:
-
isFailed
boolean isFailed()- Returns:
- true if the component has failed to start or has failed to stop.
-
addLifeCycleListener
-
removeLifeCycleListener
-
start
Utility to start an object if it is a LifeCycle and to convert any exception thrown to aRuntimeException- Parameters:
object- The instance to start.- Throws:
RuntimeException- if the call to start throws an exception.
-
stop
Utility to stop an object if it is a LifeCycle and to convert any exception thrown to aRuntimeException- Parameters:
object- The instance to stop.- Throws:
RuntimeException- if the call to stop throws an exception.
-