org.apache.curator.test
Class KillSession

java.lang.Object
  extended by 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.


Constructor Summary
KillSession()
           
 
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
 

Constructor Detail

KillSession

public KillSession()
Method Detail

kill

public static void kill(org.apache.zookeeper.ZooKeeper client,
                        String connectString)
                 throws Exception
Kill the given ZK session

Parameters:
client - the client to kill
connectString - 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 kill
connectString - server connection string
maxMs - max time ms to wait for kill
Throws:
Exception - errors


Copyright © 2011–2014 The Apache Software Foundation. All rights reserved.