Class AbstractLifecycleComponent
- All Implemented Interfaces:
Closeable
,AutoCloseable
,LifecycleComponent
,Releasable
- Direct Known Subclasses:
AbstractFileWatchingService
,AbstractHttpServerTransport
,BlobStoreRepository
,ClusterApplierService
,ClusterService
,Coordinator
,DelayedAllocationService
,FsHealthService
,GatewayService
,HealthPeriodicLogger
,IndicesClusterStateService
,IndicesMetrics
,IndicesService
,InvalidRepository
,JvmGcMonitorService
,MasterService
,MonitorService
,NodeConnectionsService
,NodeMetrics
,PeerRecoverySourceService
,ReadinessService
,RepositoriesService
,SearchService
,SeedHostsResolver
,SnapshotShardsService
,SnapshotsService
,TcpTransport
,TimestampFieldMapperService
,TransportService
,UnknownTypeRepository
Lifecycle
which is used to link its start and stop activities to those of the Elasticsearch node which
contains it.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLifecycleListener
(LifecycleListener listener) final void
close()
protected abstract void
doClose()
Close this component.protected abstract void
doStart()
Start this component.protected abstract void
doStop()
Stop this component.final void
start()
final void
stop()
-
Field Details
-
lifecycle
-
-
Constructor Details
-
AbstractLifecycleComponent
protected AbstractLifecycleComponent()Initialize this component. Other components may not yet exist when this constructor is called.
-
-
Method Details
-
lifecycleState
- Specified by:
lifecycleState
in interfaceLifecycleComponent
-
addLifecycleListener
- Specified by:
addLifecycleListener
in interfaceLifecycleComponent
-
start
public final void start()- Specified by:
start
in interfaceLifecycleComponent
-
doStart
protected abstract void doStart()Start this component. Typically that means doing things like launching background processes and registering listeners on other components. Other components have been initialized by this point, but may not yet be started.If this method throws an exception then the startup process will fail, but this component will not be stopped before it is closed.
This method is called while synchronized on
lifecycle
. It is only called once in the lifetime of a component, although it may not be called at all if the startup process encountered some kind of fatal error, such as the failure of some other component to initialize or start. -
stop
public final void stop()- Specified by:
stop
in interfaceLifecycleComponent
-
doStop
protected abstract void doStop()Stop this component. Typically that means doing the reverse of whateverdoStart()
does.This method is called while synchronized on
lifecycle
. It is only called once in the lifetime of a component, after callingdoStart()
, although it will not be called at all if this component did not successfully start. -
close
public final void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceReleasable
-
doClose
Close this component. Typically that means doing the reverse of whatever happened during initialization, such as releasing resources acquired there.This method is called while synchronized on
lifecycle
. It is called once in the lifetime of a component. If the component was started then it will be stopped before it is closed, and once it is closed it will not be started or stopped.- Throws:
IOException
-