public final class LifecycleManager extends BeanScheduler implements BeanManager
BeanManager
that manages JSR250 beans and schedules lifecycle events.BeanScheduler.CycleActivator
Modifier and Type | Field and Description |
---|---|
private LifecycleBuilder |
builder |
private java.util.Map<java.lang.Class<?>,BeanLifecycle> |
lifecycles |
private java.util.Deque<java.lang.Object> |
stoppableBeans |
CANDIDATE_CYCLE, CYCLE_ACTIVATOR, CYCLE_CONFIRMED, MODULE, pendingHolder
Constructor and Description |
---|
LifecycleManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
activate(java.lang.Object bean)
Customized activation of the given bean.
|
private boolean |
buildLifecycle(java.lang.Class<?> clazz)
Attempts to build a JSR250 lifecycle for the given bean type.
|
private BeanLifecycle |
lifecycleFor(java.lang.Object bean)
Looks up the JSR250 lifecycle previously built for this bean.
|
PropertyBinding |
manage(BeanProperty<?> property)
Asks this manager to manage the given bean property.
|
boolean |
manage(java.lang.Class<?> clazz)
Decides whether instances of the given bean type should be reported to this manager.
|
boolean |
manage(java.lang.Object bean)
Asks this manager to manage the given bean instance.
|
private java.lang.Object |
popStoppable() |
private void |
pushStoppable(java.lang.Object bean) |
private boolean |
removeStoppable(java.lang.Object bean) |
boolean |
unmanage()
Asks this manager to unmanage all the bean instances it knows about.
|
boolean |
unmanage(java.lang.Object bean)
Asks this manager to unmanage the given bean instance.
|
detectCycle, schedule
private final LifecycleBuilder builder
private final java.util.Map<java.lang.Class<?>,BeanLifecycle> lifecycles
private final java.util.Deque<java.lang.Object> stoppableBeans
public boolean manage(java.lang.Class<?> clazz)
BeanManager
manage
in interface BeanManager
clazz
- The bean typetrue
if instances of the bean should be reported; otherwise false
public PropertyBinding manage(BeanProperty<?> property)
BeanManager
manage
in interface BeanManager
property
- The bean propertynull
public boolean manage(java.lang.Object bean)
BeanManager
manage
in interface BeanManager
bean
- The bean instancetrue
if the bean instance was managed; otherwise false
public boolean unmanage(java.lang.Object bean)
BeanManager
unmanage
in interface BeanManager
bean
- The bean instancetrue
if the bean instance was unmanaged; otherwise false
public boolean unmanage()
BeanManager
unmanage
in interface BeanManager
true
if any bean instances were unmanaged; otherwise false
protected void activate(java.lang.Object bean)
BeanScheduler
activate
in class BeanScheduler
bean
- The bean to activateprivate boolean buildLifecycle(java.lang.Class<?> clazz)
clazz
- The bean typetrue
if the bean defines a lifecycle; otherwise false
private BeanLifecycle lifecycleFor(java.lang.Object bean)
bean
- The bean instanceprivate void pushStoppable(java.lang.Object bean)
private boolean removeStoppable(java.lang.Object bean)
private java.lang.Object popStoppable()