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 void
checkIsRunning()
void
destroy()
Please implementstop()
instead of overriding this (here intentionally final) method.void
init()
Please implementstart()
instead of overriding this (here intentionally final) method.boolean
isRunning()
protected abstract void
start()
protected abstract void
stop()
-
-
-
Method Detail
-
init
@PostConstruct public final void init() throws ModuleSetupRuntimeException
Please implementstart()
instead of overriding this (here intentionally final) method.- Specified by:
init
in interfaceLifecycle
- Throws:
ModuleSetupRuntimeException
- if initialization failed
-
destroy
@PreDestroy public final void destroy() throws ModuleSetupRuntimeException
Please implementstop()
instead of overriding this (here intentionally final) method.- Specified by:
destroy
in interfaceLifecycle
- Throws:
ModuleSetupRuntimeException
- if destruction failed
-
checkIsRunning
protected void checkIsRunning()
-
-