org.apache.curator.test
Class KillSession
java.lang.Object
org.apache.curator.test.KillSession
public class KillSession
- extends Object
Utility to simulate a ZK session dying. See: ZooKeeper FAQ
In the case of testing we want to cause a problem, so to explicitly expire a session an
application connects to ZooKeeper, saves the session id and password, creates another
ZooKeeper handle with that id and password, and then closes the new handle. Since both
handles reference the same session, the close on second handle will invalidate the session
causing a SESSION_EXPIRED on the first handle.
|
Method Summary |
static void |
kill(org.apache.zookeeper.ZooKeeper client,
String connectString)
Kill the given ZK session |
static void |
kill(org.apache.zookeeper.ZooKeeper client,
String connectString,
int maxMs)
Kill the given ZK session |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KillSession
public KillSession()
kill
public static void kill(org.apache.zookeeper.ZooKeeper client,
String connectString)
throws Exception
- Kill the given ZK session
- Parameters:
client - the client to killconnectString - server connection string
- Throws:
Exception - errors
kill
public static void kill(org.apache.zookeeper.ZooKeeper client,
String connectString,
int maxMs)
throws Exception
- Kill the given ZK session
- Parameters:
client - the client to killconnectString - server connection stringmaxMs - max time ms to wait for kill
- Throws:
Exception - errors
Copyright © 2011–2014 The Apache Software Foundation. All rights reserved.