Package de.intarsys.tools.component
Class CommonStartStop
- java.lang.Object
-
- de.intarsys.tools.component.CommonStartStop
-
- All Implemented Interfaces:
IInstantiable
,IStartStop
public abstract class CommonStartStop extends java.lang.Object implements IStartStop
A common implementation ofIStartStop
. This abstract class ensures that start and stop procedures are executed only once.
-
-
Constructor Summary
Constructors Constructor Description CommonStartStop()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
basicStart()
Start the component lifecycle.protected void
basicStop()
Stop the component lifecycle.boolean
isStarted()
Answertrue
if this object is startedvoid
start()
Start the component lifecycle.void
stop()
Stop the component lifecycle.boolean
stopRequested(java.util.Set visited)
Ask the component if it agrees to end its lifecycle at the very moment.
-
-
-
Method Detail
-
basicStart
protected void basicStart()
Start the component lifecycle. This method is called once at most.
-
basicStop
protected void basicStop()
Stop the component lifecycle. This method is called once at most.
-
isStarted
public final boolean isStarted()
Description copied from interface:IStartStop
Answertrue
if this object is started- Specified by:
isStarted
in interfaceIStartStop
- Returns:
- Answer
true
if this object is started.
-
start
public final void start()
Description copied from interface:IStartStop
Start the component lifecycle. A RuntimeException is expected when starting the component fails.- Specified by:
start
in interfaceIStartStop
-
stop
public final void stop()
Description copied from interface:IStartStop
Stop the component lifecycle. All resources should be freed. A RuntimeException is expected when stopping the component fails.- Specified by:
stop
in interfaceIStartStop
-
stopRequested
public boolean stopRequested(java.util.Set visited)
Description copied from interface:IStartStop
Ask the component if it agrees to end its lifecycle at the very moment. The component may deny this request, but it must be prepared anyway to be stopped.- Specified by:
stopRequested
in interfaceIStartStop
- Parameters:
visited
- The optional set of already visited objects in the stop request cycle.
-
-