Package org.apache.zookeeper.test.ClientBase

Examples of org.apache.zookeeper.test.ClientBase.CountdownWatcher.reset()


        long localSessionId2 = zk.getSessionId();

        // Send closeSession request.
        zk.close();
        watcher.reset();

        // This should be enough time for the first session to expire and for
        // the closeSession request to propagate to other machines (if there is a bug)
        // Since it is time sensitive, we have false negative when test
        // machine is under load
View Full Code Here


        // Cut the connection, so the server will create closeSession as part
        // of expiring the session.
        client.dontReconnect();
        client.disconnect();
        watcher.reset();

        // We don't validate right away, will do another session create first

        ZooKeeper zk = qb.createClient(watcher, hostPorts[testPeerIdx],
                CONNECTION_TIMEOUT);
View Full Code Here

        byte[] localSessionPwd = zk.getSessionPasswd().clone();

        // Try connecting with the same session id on a different
        // server.  This should fail since it is a local sesion.
        try {
            watcher.reset();
            DisconnectableZooKeeper zknew = new DisconnectableZooKeeper(
                    hostPorts[otherFollowerIdx], CONNECTION_TIMEOUT, watcher,
                    localSessionId, localSessionPwd);

            zknew.create(nodePrefix + "5", new byte[0],
View Full Code Here

        // If we're testing a follower, also check the session id on the
        // leader. This should also fail
        if (!testLeader) {
            try {
                watcher.reset();
                DisconnectableZooKeeper zknew = new DisconnectableZooKeeper(
                        hostPorts[leaderIdx], CONNECTION_TIMEOUT,
                        watcher, localSessionId, localSessionPwd);

                zknew.create(nodePrefix + "5", new byte[0],
View Full Code Here

        // However, we should be able to disconnect and reconnect to the same
        // server with the same session id (as long as we do it quickly
        // before expiration).
        zk.disconnect();

        watcher.reset();
        zk = new DisconnectableZooKeeper(
                hostPorts[testPeerIdx], CONNECTION_TIMEOUT, watcher,
                localSessionId, localSessionPwd);
        watcher.waitForConnected(CONNECTION_TIMEOUT);
View Full Code Here

        // If we explicitly close the session, then the session id should no
        // longer be valid.
        zk.close();
        try {
            watcher.reset();
            zk = new DisconnectableZooKeeper(
                    hostPorts[testPeerIdx], CONNECTION_TIMEOUT, watcher,
                    localSessionId, localSessionPwd);

            zk.create(nodePrefix + "7", new byte[0],
View Full Code Here

        // different server, since it has been propagated.
        long localSessionId = zk.getSessionId();
        byte[] localSessionPwd = zk.getSessionPasswd().clone();

        zk.disconnect();
        watcher.reset();
        zk = new DisconnectableZooKeeper(
                hostPorts[otherFollowerIdx], CONNECTION_TIMEOUT, watcher,
                localSessionId, localSessionPwd);
        watcher.waitForConnected(CONNECTION_TIMEOUT);
View Full Code Here

        // When we explicitly close the session, we should not be able to
        // reconnect with the same session id
        zk.close();

        try {
            watcher.reset();
            zk = new DisconnectableZooKeeper(
                    hostPorts[otherFollowerIdx], CONNECTION_TIMEOUT, watcher,
                    localSessionId, localSessionPwd);
            zk.exists(nodePrefix + "0", null);
            Assert.fail("Reconnecting to a closed session ID should fail.");
View Full Code Here

            zk.exists(nodePrefix + "0", null);
            Assert.fail("Reconnecting to a closed session ID should fail.");
        } catch (KeeperException.SessionExpiredException e) {
        }

        watcher.reset();
        // And the ephemeral nodes will be gone since the session died.
        zk = new DisconnectableZooKeeper(
                hostPorts[testPeerIdx], CONNECTION_TIMEOUT, watcher);
        watcher.waitForConnected(CONNECTION_TIMEOUT);
        for (int i = 0; i < 5; i++) {
View Full Code Here

        final String node1 = "/tnode1";
        final String node2 = "/tnode2";
        zk.create(node1, data.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE,
                CreateMode.PERSISTENT);

        watcher.reset();
        qu.shutdown(2);
        watcher.waitForConnected(CONNECTION_TIMEOUT);
        Assert.assertEquals("Should be in r-o mode", States.CONNECTEDREADONLY,
                zk.getState());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.