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:
AutoCloseable,LifecycleComponent
- Direct Known Subclasses:
DataIntegrityService,RxSchedulerLifecycleComponent,ServerLifecycleComponent
public abstract class AbstractLifecycleComponent<ConfT extends ComponentConfiguration>
extends AbstractComponent<ConfT>
implements LifecycleComponent
A mix of
AbstractComponent and LifecycleComponent.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Lifecycleprotected final StatsLoggerprotected Thread.UncaughtExceptionHandlerFields inherited from class org.apache.bookkeeper.common.component.AbstractComponent
componentName, conf -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractLifecycleComponent(String componentName, ConfT conf, StatsLogger statsLogger) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifecycleListener(LifecycleListener listener) voidclose()protected abstract voiddoClose()protected abstract voiddoStart()protected abstract voiddoStop()protected StatsLoggervoidremoveLifecycleListener(LifecycleListener listener) voidSet 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, getNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.bookkeeper.common.component.LifecycleComponent
getName, publishInfo
-
Field Details
-
lifecycle
-
statsLogger
-
uncaughtExceptionHandler
-
-
Constructor Details
-
AbstractLifecycleComponent
-
-
Method Details
-
setExceptionHandler
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
-
lifecycleState
- Specified by:
lifecycleStatein interfaceLifecycleComponent
-
addLifecycleListener
- Specified by:
addLifecycleListenerin interfaceLifecycleComponent
-
removeLifecycleListener
- 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 interfaceAutoCloseable- Specified by:
closein interfaceLifecycleComponent
-
doClose
- Throws:
IOException
-