Class AbstractLifecycleComponent
- All Implemented Interfaces:
Closeable,AutoCloseable,LifecycleComponent,Releasable
- Direct Known Subclasses:
AbstractFileWatchingService,AbstractHttpServerTransport,BlobStoreRepository,CircuitBreakerService,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 TypeMethodDescriptionvoidaddLifecycleListener(LifecycleListener listener) final voidclose()protected abstract voiddoClose()Close this component.protected abstract voiddoStart()Start this component.protected abstract voiddoStop()Stop this component.final voidstart()final voidstop()
-
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:
lifecycleStatein interfaceLifecycleComponent
-
addLifecycleListener
- Specified by:
addLifecycleListenerin interfaceLifecycleComponent
-
start
public final void start()- Specified by:
startin 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:
stopin 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein 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
-