Class AbstractLifecycle
- java.lang.Object
-
- org.opendaylight.infrautils.inject.AbstractLifecycle
-
- All Implemented Interfaces:
Lifecycle
public abstract class AbstractLifecycle extends Object implements Lifecycle
Support class forLifecycle. Provides a convenient base implementation including correct thread safety, exception handling and check for accidental unnecessary re-start & stop. Subclasses must implementstart()&stop().- Author:
- Michael Vorburger (with guidance re. AtomicReference from Tom Pantelis)
-
-
Constructor Summary
Constructors Constructor Description AbstractLifecycle()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckIsRunning()voiddestroy()Please implementstop()instead of overriding this (here intentionally final) method.voidinit()Please implementstart()instead of overriding this (here intentionally final) method.booleanisRunning()protected abstract voidstart()protected abstract voidstop()
-
-
-
Method Detail
-
init
@PostConstruct public final void init() throws ModuleSetupRuntimeExceptionPlease implementstart()instead of overriding this (here intentionally final) method.- Specified by:
initin interfaceLifecycle- Throws:
ModuleSetupRuntimeException- if initialization failed
-
destroy
@PreDestroy public final void destroy() throws ModuleSetupRuntimeExceptionPlease implementstop()instead of overriding this (here intentionally final) method.- Specified by:
destroyin interfaceLifecycle- Throws:
ModuleSetupRuntimeException- if destruction failed
-
checkIsRunning
protected void checkIsRunning()
-
-