Package org.picocontainer.lifecycle
Class AbstractMonitoringLifecycleStrategy
- java.lang.Object
-
- org.picocontainer.lifecycle.AbstractMonitoringLifecycleStrategy
-
- All Implemented Interfaces:
java.io.Serializable
,ComponentMonitorStrategy
,LifecycleStrategy
- Direct Known Subclasses:
JavaEE5LifecycleStrategy
,ReflectionLifecycleStrategy
,StartableLifecycleStrategy
public abstract class AbstractMonitoringLifecycleStrategy extends java.lang.Object implements LifecycleStrategy, ComponentMonitorStrategy, java.io.Serializable
Abstract base class for lifecycle strategy implementation supporting aComponentMonitor
.- Author:
- Jörg Schaible
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractMonitoringLifecycleStrategy(ComponentMonitor monitor)
Construct a AbstractMonitoringLifecycleStrategy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeMonitor(ComponentMonitor monitor)
Swaps the current monitor with a replacement.ComponentMonitor
currentMonitor()
Returns the monitor currently usedboolean
isLazy(ComponentAdapter<?> adapter)
Is a component eager (not lazy) in that it should start when start() or equivalent is called, or lazy (it will only start on first getComponent() ).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.picocontainer.LifecycleStrategy
dispose, hasLifecycle, start, stop
-
-
-
-
Constructor Detail
-
AbstractMonitoringLifecycleStrategy
public AbstractMonitoringLifecycleStrategy(ComponentMonitor monitor)
Construct a AbstractMonitoringLifecycleStrategy.- Parameters:
monitor
- the componentMonitor to use- Throws:
java.lang.NullPointerException
- if the monitor isnull
-
-
Method Detail
-
changeMonitor
public void changeMonitor(ComponentMonitor monitor)
Swaps the current monitor with a replacement.- Specified by:
changeMonitor
in interfaceComponentMonitorStrategy
- Parameters:
monitor
- The new monitor.- Throws:
java.lang.NullPointerException
- if the passed in monitor is null.
-
currentMonitor
public ComponentMonitor currentMonitor()
Description copied from interface:ComponentMonitorStrategy
Returns the monitor currently used- Specified by:
currentMonitor
in interfaceComponentMonitorStrategy
- Returns:
- The ComponentMonitor currently used
-
isLazy
public boolean isLazy(ComponentAdapter<?> adapter)
Description copied from interface:LifecycleStrategy
Is a component eager (not lazy) in that it should start when start() or equivalent is called, or lazy (it will only start on first getComponent() ). The default is the first of those two.- Specified by:
isLazy
in interfaceLifecycleStrategy
- Returns:
- true if lazy, false if not lazy
-
-