Package org.apache.zookeeper.test.system
Class InstanceManager
java.lang.Object
org.apache.zookeeper.test.system.InstanceManager
- All Implemented Interfaces:
AsyncCallback,AsyncCallback.ChildrenCallback,Watcher
This class doles out assignments to InstanceContainers that are registered to
a ZooKeeper znode. The znode will have four child nodes:
* ready: this znode indicates that the InstanceManager is running
* available: the children of this znode are ephemeral nodes representing
running InstanceContainers
* assignments: there will be a child under this znode for each available
InstanceContainer. those znodes will have a child for each
assigned instance
* reports: there will be a child under this znode for each instance that is
running. it will have the report string from the instance.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.zookeeper.AsyncCallback
AsyncCallback.ACLCallback, AsyncCallback.AllChildrenNumberCallback, AsyncCallback.Children2Callback, AsyncCallback.ChildrenCallback, AsyncCallback.Create2Callback, AsyncCallback.DataCallback, AsyncCallback.EphemeralsCallback, AsyncCallback.MultiCallback, AsyncCallback.StatCallback, AsyncCallback.StringCallback, AsyncCallback.VoidCallbackNested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
Watcher.Event, Watcher.WatcherType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassignInstance(String name, Class<? extends Instance> clazz, String params, int weight) voidclose()voidprocess(WatchedEvent event) voidprocessResult(int rc, String path, Object ctx, List<String> children) voidreconfigureInstance(String name, String params) voidremoveInstance(String name) voidresetStatus(String name)
-
Constructor Details
-
InstanceManager
- Throws:
KeeperExceptionInterruptedException
-
-
Method Details
-
processResult
- Specified by:
processResultin interfaceAsyncCallback.ChildrenCallback
-
process
-
assignInstance
public String assignInstance(String name, Class<? extends Instance> clazz, String params, int weight) throws NoAvailableContainers, DuplicateNameException, InterruptedException, KeeperException -
reconfigureInstance
public void reconfigureInstance(String name, String params) throws NoAssignmentException, InterruptedException, KeeperException -
removeInstance
- Throws:
InterruptedExceptionKeeperException
-
resetStatus
- Throws:
InterruptedExceptionKeeperException
-
getStatus
- Throws:
KeeperExceptionInterruptedException
-
close
- Throws:
InterruptedException
-