io.airlift.bootstrap
Class LifeCycleManager

java.lang.Object
  extended by io.airlift.bootstrap.LifeCycleManager

public class LifeCycleManager
extends Object

Manages PostConstruct and PreDestroy life cycles


Constructor Summary
LifeCycleManager(List<Object> managedInstances, io.airlift.bootstrap.LifeCycleMethodsMap methodsMap)
           
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LifeCycleManager

public LifeCycleManager(List<Object> managedInstances,
                        io.airlift.bootstrap.LifeCycleMethodsMap methodsMap)
                 throws Exception
Parameters:
managedInstances - list of objects that have life cycle annotations
methodsMap - existing or new methods map
Throws:
Exception - exceptions starting instances (depending on mode)
Method Detail

size

public int size()
Returns the number of managed instances

Returns:
qty

start

public void start()
           throws Exception
Start the life cycle - all instances will have their PostConstruct method(s) called

Throws:
Exception - errors

stop

public void stop()
          throws Exception
Stop the life cycle - all instances will have their PreDestroy method(s) called

Throws:
Exception - errors

addInstance

public void addInstance(Object instance)
                 throws Exception
Add an additional managed instance

Parameters:
instance - instance to add
Throws:
Exception - errors


Copyright © 2010-2012 Airlift. All Rights Reserved.