Class AbstractLifecycleComponent<ConfT extends ComponentConfiguration>
- java.lang.Object
-
- org.apache.bookkeeper.common.component.AbstractComponent<ConfT>
-
- org.apache.bookkeeper.common.component.AbstractLifecycleComponent<ConfT>
-
- All Implemented Interfaces:
java.lang.AutoCloseable,LifecycleComponent
- Direct Known Subclasses:
DataIntegrityService,RxSchedulerLifecycleComponent,ServerLifecycleComponent
public abstract class AbstractLifecycleComponent<ConfT extends ComponentConfiguration> extends AbstractComponent<ConfT> implements LifecycleComponent
A mix ofAbstractComponentandLifecycleComponent.
-
-
Field Summary
Fields Modifier and Type Field Description protected Lifecyclelifecycleprotected StatsLoggerstatsLoggerprotected java.lang.Thread.UncaughtExceptionHandleruncaughtExceptionHandler-
Fields inherited from class org.apache.bookkeeper.common.component.AbstractComponent
componentName, conf
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractLifecycleComponent(java.lang.String componentName, ConfT conf, StatsLogger statsLogger)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddLifecycleListener(LifecycleListener listener)voidclose()protected abstract voiddoClose()protected abstract voiddoStart()protected abstract voiddoStop()protected StatsLoggergetStatsLogger()Lifecycle.StatelifecycleState()voidremoveLifecycleListener(LifecycleListener listener)voidsetExceptionHandler(java.lang.Thread.UncaughtExceptionHandler handler)Set the default handler invoked when a lifecycle component abruptly terminates due an uncaught exception.voidstart()voidstop()-
Methods inherited from class org.apache.bookkeeper.common.component.AbstractComponent
getConf, getName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.bookkeeper.common.component.LifecycleComponent
getName, publishInfo
-
-
-
-
Field Detail
-
lifecycle
protected final Lifecycle lifecycle
-
statsLogger
protected final StatsLogger statsLogger
-
uncaughtExceptionHandler
protected volatile java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler
-
-
Constructor Detail
-
AbstractLifecycleComponent
protected AbstractLifecycleComponent(java.lang.String componentName, ConfT conf, StatsLogger statsLogger)
-
-
Method Detail
-
setExceptionHandler
public void setExceptionHandler(java.lang.Thread.UncaughtExceptionHandler handler)
Description copied from interface:LifecycleComponentSet the default handler invoked when a lifecycle component abruptly terminates due an uncaught exception.- Specified by:
setExceptionHandlerin interfaceLifecycleComponent- Parameters:
handler- handler invoked when an uncaught exception happens in the lifecycle component.
-
getStatsLogger
protected StatsLogger getStatsLogger()
-
lifecycleState
public Lifecycle.State lifecycleState()
- Specified by:
lifecycleStatein interfaceLifecycleComponent
-
addLifecycleListener
public void addLifecycleListener(LifecycleListener listener)
- Specified by:
addLifecycleListenerin interfaceLifecycleComponent
-
removeLifecycleListener
public void removeLifecycleListener(LifecycleListener listener)
- Specified by:
removeLifecycleListenerin interfaceLifecycleComponent
-
start
public void start()
- Specified by:
startin interfaceLifecycleComponent
-
doStart
protected abstract void doStart()
-
stop
public void stop()
- Specified by:
stopin interfaceLifecycleComponent
-
doStop
protected abstract void doStop()
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceLifecycleComponent
-
doClose
protected abstract void doClose() throws java.io.IOException- Throws:
java.io.IOException
-
-