public final class LifeCycleManager
extends java.lang.Object
| Constructor and Description |
|---|
LifeCycleManager(java.util.List<java.lang.Object> managedInstances,
org.embulk.guice.LifeCycleMethodsMap methodsMap,
java.util.List<LifeCycleListener> listeners) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInstance(java.lang.Object instance)
Add an additional managed instance
|
void |
destroy()
Stop the life cycle - all instances will have their
PreDestroy method(s) called |
void |
destroyOnShutdownHook()
Add a shutdown hook that calls
destroy method |
boolean |
isDestroyed()
Return true if
destroy is called |
int |
size()
Returns the number of managed instances
|
void |
start()
Start the life cycle - all instances will have their
PostConstruct method(s) called |
public LifeCycleManager(java.util.List<java.lang.Object> managedInstances,
org.embulk.guice.LifeCycleMethodsMap methodsMap,
java.util.List<LifeCycleListener> listeners)
throws java.lang.Exception
managedInstances - list of objects that have life cycle annotationsmethodsMap - existing or new methods maplisteners - listeners called when state changesjava.lang.Exception - exceptions starting instances (depending on mode)public int size()
public void start()
PostConstruct method(s) calledpublic void destroyOnShutdownHook()
destroy methodpublic void destroy()
throws java.lang.Exception
PreDestroy method(s) calledjava.lang.Exception - errorspublic boolean isDestroyed()
destroy is calledpublic void addInstance(java.lang.Object instance)
throws java.lang.Exception
instance - instance to addjava.lang.Exception - errors