Package org.eclipse.jetty.util.component
Interface LifeCycle
-
- All Known Subinterfaces:
AppProvider,Connector,Handler,HandlerContainer,NetworkConnector,Scheduler,ServletContextHandler.ServletContainerInitializerCaller,SessionCache,SessionDataMap,SessionDataStore,SessionIdManager
- All Known Implementing Classes:
AbstractConnectionFactory,AbstractConnectionPool,AbstractConnector,AbstractConnectorHttpClientTransport,AbstractConnectorHttpClientTransport.ClientSelectorManager,AbstractContextProvider,AbstractEventDriver,AbstractExtension,AbstractHandler,AbstractHandler.ErrorDispatchHandler,AbstractHandlerContainer,AbstractHTTP2ServerConnectionFactory,AbstractHttpClientTransport,AbstractJsrEventDriver,AbstractLeakPreventer,AbstractLifeCycle,AbstractLoginService,AbstractNCSARequestLog,AbstractNetworkConnector,AbstractSessionCache,AbstractSessionDataStore,AbstractWebAppProvider,AcceptRateLimit,AllowedResourceAliasChecker,ALPNServerConnectionFactory,AntWebAppContext,AntWebAppContext.AntServletHandler,AntWebAppContext.AntServletHolder,AppContextLeakPreventer,AsyncDelayHandler,AsyncNCSARequestLog,AsyncRequestLogWriter,AttributeContainerMap,AWTLeakPreventer,BaseHolder,BufferedResponseHandler,BundleContextProvider,BundleWebAppProvider,CachingSessionDataStore,ClientContainer,CompressExtension,CompressionPool,ConfigurableSpnegoLoginService,ConnectHandler,ConnectHandler.ConnectManager,ConnectionLimit,ConnectionManager,ConnectionStatistics,ConnectorServer,ConnectorStatistics,ConstraintSecurityHandler,ContainerLifeCycle,ContextHandler,ContextHandlerCollection,CustomRequestLog,DataSourceLoginService,DebugHandler,DebugListener,DefaultHandler,DefaultSessionCache,DefaultSessionIdManager,DeflateFrameExtension,DeflaterPool,DelegatingThreadPool,DeploymentManager,DetectorConnectionFactory,DOMLeakPreventer,DriverManagerLeakPreventer,DuplexConnectionPool,EatWhatYouKill,ErrorHandler,ErrorPageErrorHandler,ExecutorSizedThreadPool,ExecutorThreadPool,ExtensionStack,FileBufferedResponseHandler,FileSessionDataStore,FilterHolder,FragmentExtension,FrameCaptureExtension,GCloudSessionDataStore,GCThreadLeakPreventer,GzipHandler,HandlerCollection,HandlerList,HandlerWrapper,HashLoginService,HazelcastSessionDataStore,HelloHandler,HelloWorld,Holder,HotSwapHandler,HouseKeeper,HTTP2Client,HTTP2ClientSession,HTTP2CServerConnectionFactory,HTTP2ServerConnectionFactory,HTTP2ServerSession,HTTP2Session,HttpClient,HttpClientTransportOverFCGI,HttpClientTransportOverHTTP,HttpClientTransportOverHTTP2,HttpClientTransportOverUnixSockets,HttpClientTransportOverUnixSockets.UnixSocketSelectorManager,HttpConnectionFactory,HttpDestination,HttpDestinationOverFCGI,HttpDestinationOverHTTP,HttpDestinationOverHTTP2,HttpServiceErrorPageErrorHandler,HttpSpiContextHandler,IdentityExtension,IdleTimeoutHandler,IncludeExcludeConnectionStatistics,InetAccessHandler,InfinispanSessionDataStore,InflaterPool,IPAccessHandler,JAASLoginService,Java2DLeakPreventer,JDBCLoginService,JDBCSessionDataStore,JettyAnnotatedEventDriver,JettyListenerEventDriver,JettyWebAppContext,JsrAnnotatedEventDriver,JsrEndpointEventDriver,JsrSession,JsrSessionTracker,KeyStoreScanner,LDAPLeakPreventer,LeakDetector,LeakTrackingByteBufferPool,LeakTrackingConnectionPool,ListenerHolder,LocalConnector,LoginConfigurationLeakPreventer,LowResourceMonitor,ManagedSelector,ManyHandlers.ParamHandler,ManyHandlers.WelcomeWrapHandler,MavenServerConnector,MemcachedSessionDataMap,MongoSessionDataStore,MonitoredQueuedThreadPool,MovedContextHandler,MultiplexConnectionPool,MultiplexHttpDestination,MultiplexHttpDestinationOverFCGI,NativeWebSocketConfiguration,NCSARequestLog,NegotiatingServerConnectionFactory,NetworkTrafficSelectChannelConnector,NetworkTrafficServerConnector,NoSqlSessionDataStore,NullSessionCache,NullSessionDataStore,OpenIdConfiguration,OpenIdLoginService,OptionalSslConnectionFactory,PathWatcher,PerMessageDeflateExtension,PoolingHttpDestination,PropertyUserStore,PropertyUserStoreManager,ProxyConnectionFactory,QueuedThreadPool,QuickStartWebApp,RandomConnectionPool,RawHTTP2ServerConnectionFactory,RequestLogHandler,RequestLogWriter,ReservedThreadExecutor,ResourceHandler,RewriteHandler,RoundRobinConnectionPool,Scanner,ScanningAppProvider,ScheduledExecutorScheduler,ScopedHandler,SecuredRedirectHandler,SecurityHandler,SecurityProviderLeakPreventer,SelectorManager,Server,ServerConnectionStatistics,ServerConnector,ServerConnector.ServerConnectorManager,ServerContainer,ServerFCGIConnectionFactory,ServiceContextProvider,ServiceWebAppProvider,ServletContainerInitializersStarter,ServletContextHandler,ServletContextHandler.Initializer,ServletHandler,ServletHolder,SessionHandler,SessionTracker,ShutdownHandler,SimpleContainerScope,SizeLimitHandler,Slf4jRequestLog,Slf4jRequestLogWriter,SpnegoLoginService,SslConnectionFactory,SslContextFactory,SslContextFactory.Client,SslContextFactory.Server,StatisticsHandler,StopLifeCycle,Sweeper,SymlinkAllowedResourceAliasChecker,ThreadLimitHandler,TimerScheduler,UnixSocketConnector,UnixSocketConnector.UnixSocketConnectorManager,UserStore,ValidatingConnectionPool,WebAppContext,WebAppProvider,WebSocketClient,WebSocketExtensionFactory,WebSocketHandler,WebSocketHandler.Simple,WebSocketServerFactory,WebSocketSession,WebSocketUpgradeHandlerWrapper,XWebkitDeflateFrameExtension
@ManagedObject("Lifecycle Interface for startable components") public interface LifeCycle
The lifecycle interface for generic components.
Classes implementing this interface have a defined life cycle defined by the methods of this interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceLifeCycle.ListenerListener.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddLifeCycleListener(LifeCycle.Listener listener)booleanisFailed()booleanisRunning()booleanisStarted()booleanisStarting()booleanisStopped()booleanisStopping()voidremoveLifeCycleListener(LifeCycle.Listener listener)voidstart()Starts the component.static voidstart(java.lang.Object object)Utility to start an object if it is a LifeCycle and to convert any exception thrown to aRuntimeExceptionvoidstop()Stops the component.static voidstop(java.lang.Object object)Utility to stop an object if it is a LifeCycle and to convert any exception thrown to aRuntimeException
-
-
-
Method Detail
-
start
@ManagedOperation(value="Starts the instance", impact="ACTION") void start() throws java.lang.Exception
Starts the component.- Throws:
java.lang.Exception- If the component fails to start- See Also:
isStarted(),stop(),isFailed()
-
stop
@ManagedOperation(value="Stops the instance", impact="ACTION") void stop() throws java.lang.Exception
Stops the component. The component may wait for current activities to complete normally, but it can be interrupted.- Throws:
java.lang.Exception- If the component fails to stop- See Also:
isStopped(),start(),isFailed()
-
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:
start(),isStarting()
-
isStarting
boolean isStarting()
- Returns:
- true if the component is starting.
- See Also:
isStarted()
-
isStopping
boolean isStopping()
- Returns:
- true if the component is stopping.
- See Also:
isStopped()
-
isStopped
boolean isStopped()
- Returns:
- true if the component has been stopped.
- See Also:
stop(),isStopping()
-
isFailed
boolean isFailed()
- Returns:
- true if the component has failed to start or has failed to stop.
-
addLifeCycleListener
void addLifeCycleListener(LifeCycle.Listener listener)
-
removeLifeCycleListener
void removeLifeCycleListener(LifeCycle.Listener listener)
-
start
static void start(java.lang.Object object)
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:
java.lang.RuntimeException- if the call to start throws an exception.
-
stop
static void stop(java.lang.Object object)
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:
java.lang.RuntimeException- if the call to stop throws an exception.
-
-