Class AutoCloseableLifecycleComponent
java.lang.Object
org.apache.bookkeeper.common.component.AutoCloseableLifecycleComponent
- All Implemented Interfaces:
AutoCloseable,LifecycleComponent
Allows for AutoClosable resources to be added to the component
lifecycle without having to implement ServerLifecycleComponent directly.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Lifecycleprotected Thread.UncaughtExceptionHandler -
Constructor Summary
ConstructorsConstructorDescriptionAutoCloseableLifecycleComponent(String componentName, AutoCloseable closeable) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifecycleListener(LifecycleListener listener) voidclose()getName()voidremoveLifecycleListener(LifecycleListener listener) voidSet the default handler invoked when a lifecycle component abruptly terminates due an uncaught exception.voidstart()voidstop()Methods 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
publishInfo
-
Field Details
-
lifecycle
-
uncaughtExceptionHandler
-
-
Constructor Details
-
AutoCloseableLifecycleComponent
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceLifecycleComponent
-
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.
-
lifecycleState
- Specified by:
lifecycleStatein interfaceLifecycleComponent
-
addLifecycleListener
- Specified by:
addLifecycleListenerin interfaceLifecycleComponent
-
removeLifecycleListener
- Specified by:
removeLifecycleListenerin interfaceLifecycleComponent
-
start
public void start()- Specified by:
startin interfaceLifecycleComponent
-
stop
public void stop()- Specified by:
stopin interfaceLifecycleComponent
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceLifecycleComponent
-