public final class LifeCycleManager extends Object
| Constructor and Description |
|---|
LifeCycleManager(List<Object> managedInstances,
io.airlift.bootstrap.LifeCycleMethodsMap methodsMap) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInstance(Object instance)
Add an additional managed instance
|
int |
size()
Returns the number of managed instances
|
void |
start()
Start the life cycle - all instances will have their
PostConstruct method(s) called |
void |
stop()
Stop the life cycle - all instances will have their
PreDestroy method(s) called
and any exceptions raised will be immediately logged. |
void |
stopWithoutFailureLogging()
Stop the life cycle - all instances will have their
PreDestroy method(s) called
and any exceptions raised will be collected and thrown in a wrapped LifeCycleStopException as
suppressed exceptions. |
public LifeCycleManager(List<Object> managedInstances, io.airlift.bootstrap.LifeCycleMethodsMap methodsMap) throws LifeCycleStartException
managedInstances - list of objects that have life cycle annotationsmethodsMap - existing or new methods mapLifeCycleStartException - exceptions starting instances (depending on mode)public int size()
public void start()
throws LifeCycleStartException
PostConstruct method(s) calledLifeCycleStartExceptionpublic void stopWithoutFailureLogging()
throws LifeCycleStopException
PreDestroy method(s) called
and any exceptions raised will be collected and thrown in a wrapped LifeCycleStopException as
suppressed exceptions. Those failures will not be logged and are the responsibility of the caller to
handle appropriately.LifeCycleStopException - If any failure occurs during the clean up processpublic void stop()
throws LifeCycleStopException
PreDestroy method(s) called
and any exceptions raised will be immediately logged. If any such exceptions occur, a single
LifeCycleStopException will be raised at the end of processing which will not
contain any reference to exceptions already logged.LifeCycleStopException - If any failure occurs during the clean up processpublic void addInstance(Object instance) throws LifeCycleStartException
instance - instance to addLifeCycleStartException - errors during PostConstruct method invocationIllegalStateException - if the life cycle has been stoppedCopyright © 2010–2021 Airlift. All rights reserved.