Package dk.netarkivet.common.lifecycle
Class LifeCycleComponent
- java.lang.Object
-
- dk.netarkivet.common.lifecycle.LifeCycleComponent
-
- All Implemented Interfaces:
ComponentLifeCycle
- Direct Known Subclasses:
HarvestJobManager
public class LifeCycleComponent extends Object implements ComponentLifeCycle
Takes care of the lifecycling of subcomponents(children).When extending this class you must:
- Add all lifecycle subcomponents with the addChild, before the start method is called.
- Call the
super.start()
operation to start the children. - Call the
super.shutdown
operation to
-
-
Constructor Summary
Constructors Constructor Description LifeCycleComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(ComponentLifeCycle childComponent)
Adds a childComponentLifeCycle
.void
shutdown()
The inverse of thestart()
method.void
start()
Implements functionality for starting an instances of thisComponentLifeCycle
object.
-
-
-
Method Detail
-
start
public void start()
Description copied from interface:ComponentLifeCycle
Implements functionality for starting an instances of thisComponentLifeCycle
object. This may be loading files, establish connections, initializing data, starting threads, etc.- Specified by:
start
in interfaceComponentLifeCycle
-
shutdown
public void shutdown()
Description copied from interface:ComponentLifeCycle
The inverse of thestart()
method. Contains functionality for deallocation of ressources, clearing data, closing connections, stopping threads, etc- Specified by:
shutdown
in interfaceComponentLifeCycle
-
addChild
public void addChild(ComponentLifeCycle childComponent)
Adds a childComponentLifeCycle
. The childs lifecycle will be managed by by theLifeCycleComponent
.- Parameters:
childComponent
- The child to add
-
-