Package org.apache.zookeeper.test.system
Class SimpleClient
- java.lang.Object
-
- org.apache.zookeeper.test.system.SimpleClient
-
- All Implemented Interfaces:
AsyncCallback
,AsyncCallback.DataCallback
,AsyncCallback.StatCallback
,AsyncCallback.StringCallback
,Instance
,Watcher
public class SimpleClient extends java.lang.Object implements Instance, Watcher, AsyncCallback.DataCallback, AsyncCallback.StringCallback, AsyncCallback.StatCallback
The client that gets spawned for the SimpleSysTest
-
-
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.VoidCallback
-
Nested classes/interfaces inherited from interface org.apache.zookeeper.test.system.Instance
Instance.Reporter
-
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
Watcher.Event, Watcher.WatcherType
-
-
Constructor Summary
Constructors Constructor Description SimpleClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(java.lang.String params)
This will be the second method invoked by the InstanceContainer.void
process(WatchedEvent event)
void
processResult(int rc, java.lang.String path, java.lang.Object ctx, byte[] data, Stat stat)
Process the result of asynchronous calls.void
processResult(int rc, java.lang.String path, java.lang.Object ctx, java.lang.String name)
Process the result of the asynchronous call.void
processResult(int rc, java.lang.String path, java.lang.Object ctx, Stat stat)
Process the result of the asynchronous call.void
setReporter(Instance.Reporter r)
This will be the first method invoked by the InstanceContainer after an instance of this interface has been constructed.void
start()
Starts this instance.void
stop()
Stops this instance.java.lang.String
toString()
-
-
-
Method Detail
-
configure
public void configure(java.lang.String params)
Description copied from interface:Instance
This will be the second method invoked by the InstanceContainer. It may be invoked again if the configuration changes.
-
start
public void start()
Description copied from interface:Instance
Starts this instance.
-
stop
public void stop()
Description copied from interface:Instance
Stops this instance.
-
process
public void process(WatchedEvent event)
-
processResult
public void processResult(int rc, java.lang.String path, java.lang.Object ctx, byte[] data, Stat stat)
Description copied from interface:AsyncCallback.DataCallback
Process the result of asynchronous calls.On success, rc is
KeeperException.Code.OK
.On failure, rc is set to the corresponding failure code in
KeeperException
.KeeperException.Code.NONODE
- The node on given path doesn't exist for some API calls.
- Specified by:
processResult
in interfaceAsyncCallback.DataCallback
- Parameters:
rc
- The return code or the result of the call.path
- The path that we passed to asynchronous calls.ctx
- Whatever context object that we passed to asynchronous calls.data
- The data of the node.stat
-Stat
object of the node on given path.- See Also:
ZooKeeper.getData(String, boolean, AsyncCallback.DataCallback, Object)
,ZooKeeper.getData(String, Watcher, AsyncCallback.DataCallback, Object)
,ZooKeeper.getConfig(boolean, AsyncCallback.DataCallback, Object)
,ZooKeeper.getConfig(Watcher, AsyncCallback.DataCallback, Object)
-
processResult
public void processResult(int rc, java.lang.String path, java.lang.Object ctx, java.lang.String name)
Description copied from interface:AsyncCallback.StringCallback
Process the result of the asynchronous call.On success, rc is
KeeperException.Code.OK
.On failure, rc is set to the corresponding failure code in
KeeperException
.KeeperException.Code.NODEEXISTS
- The node on give path already exists for some API calls.KeeperException.Code.NONODE
- The node on given path doesn't exist for some API calls.KeeperException.Code.NOCHILDRENFOREPHEMERALS
- An ephemeral node cannot have children. There is discussion in community. It might be changed in the future.
- Specified by:
processResult
in interfaceAsyncCallback.StringCallback
- Parameters:
rc
- The return code or the result of the call.path
- The path that we passed to asynchronous calls.ctx
- Whatever context object that we passed to asynchronous calls.name
- The name of the znode that was created. On success, name and path are usually equal, unless a sequential node has been created.- See Also:
ZooKeeper.create(String, byte[], List, CreateMode, AsyncCallback.StringCallback, Object)
-
processResult
public void processResult(int rc, java.lang.String path, java.lang.Object ctx, Stat stat)
Description copied from interface:AsyncCallback.StatCallback
Process the result of the asynchronous call.On success, rc is
KeeperException.Code.OK
.On failure, rc is set to the corresponding failure code in
KeeperException
.-
KeeperException.Code.NONODE
- The node on given path doesn't exist for some API calls. -
KeeperException.Code.BADVERSION
- The given version doesn't match the node's version for some API calls.
- Specified by:
processResult
in interfaceAsyncCallback.StatCallback
- Parameters:
rc
- The return code or the result of the call.path
- The path that we passed to asynchronous calls.ctx
- Whatever context object that we passed to asynchronous calls.stat
-Stat
object of the node on given path.- See Also:
ZooKeeper.exists(String, boolean, AsyncCallback.StatCallback, Object)
,ZooKeeper.exists(String, Watcher, AsyncCallback.StatCallback, Object)
,ZooKeeper.setData(String, byte[], int, AsyncCallback.StatCallback, Object)
,ZooKeeper.setACL(String, List, int, AsyncCallback.StatCallback, Object)
-
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
setReporter
public void setReporter(Instance.Reporter r)
Description copied from interface:Instance
This will be the first method invoked by the InstanceContainer after an instance of this interface has been constructed. It will only be invoked once.- Specified by:
setReporter
in interfaceInstance
- Parameters:
r
- a handle to use to report on status changes.
-
-