Package org.apache.zookeeper.server.quorum.QuorumCnxManager

Examples of org.apache.zookeeper.server.quorum.QuorumCnxManager.Message


                this.manager = manager;
            }

            public void run() {
               
              Message response;
              while (true) {
                    // Sleeps on receive
                try{
                  response = manager.recvQueue.take();
                 
View Full Code Here


                this.manager = manager;
            }

            public void run() {
               
              Message response;
              while (!stop) {
                    // Sleeps on receive
                try{
                  response = manager.recvQueue.poll(3000, TimeUnit.MILLISECONDS);
                  if(response == null) continue;
View Full Code Here

                this.manager = manager;
            }

            public void run() {
               
              Message response;
              while (true) {
                    // Sleeps on receive
                try{
                  response = manager.recvQueue.take();
                 
View Full Code Here

            LOG.error("Null listener when initializing cnx manager");
        }

        cnxManager.toSend(new Long(0), createMsg(ServerState.LOOKING.ordinal(), 1, -1, 1));

        Message m = null;
        int numRetries = 1;
        while((m == null) && (numRetries++ <= THRESHOLD)){
            m = cnxManager.pollRecvQueue(3000, TimeUnit.MILLISECONDS);
            if(m == null) cnxManager.connectAll();
        }
View Full Code Here

                }

                long sid = 1;
                cnxManager.toSend(sid, createMsg(ServerState.LOOKING.ordinal(), 0, -1, 1));

                Message m = null;
                int numRetries = 1;
                while((m == null) && (numRetries++ <= THRESHOLD)){
                    m = cnxManager.pollRecvQueue(3000, TimeUnit.MILLISECONDS);
                    if(m == null) cnxManager.connectAll();
                }
View Full Code Here

                this.manager = manager;
            }

            public void run() {

                Message response;
                while (!stop) {
                    // Sleeps on receive
                    try{
                        response = manager.pollRecvQueue(3000, TimeUnit.MILLISECONDS);
                        if(response == null) continue;
View Full Code Here

        /*
         * Check that it generates an internal notification correctly
         */
        MockFLEMessengerBackward fle = new MockFLEMessengerBackward(peer, mng);
        ByteBuffer buffer = FastLeaderElection.buildMsg(ServerState.LOOKING.ordinal(), 2, 0x1, 1, 1);
        fle.manager.recvQueue.add(new Message(buffer, 2));
        Notification n = fle.recvqueue.take();
        Assert.assertTrue("Wrong state", n.state == ServerState.LOOKING);
        Assert.assertTrue("Wrong leader", n.leader == 2);
        Assert.assertTrue("Wrong zxid", n.zxid == 0x1);
        Assert.assertTrue("Wrong epoch", n.electionEpoch == 1);
        Assert.assertTrue("Wrong epoch", n.peerEpoch == 1);
       
        /*
         * Check that it sends a notification back to the sender
         */
        peer.setPeerState(ServerState.FOLLOWING);
        peer.setCurrentVote( new Vote(2, 0x1, 1, 1, ServerState.LOOKING) );
        buffer = FastLeaderElection.buildMsg(ServerState.LOOKING.ordinal(), 1, 0x1, 1, 1);
        fle.manager.recvQueue.add(new Message(buffer, 1));
        ToSend m = fle.internalqueue.take();
        Assert.assertTrue("Wrong state", m.state == ServerState.FOLLOWING);
        Assert.assertTrue("Wrong sid", m.sid == 1);
        Assert.assertTrue("Wrong leader", m.leader == 2);
        Assert.assertTrue("Wrong epoch", m.electionEpoch == 1);
View Full Code Here

        notBuffer.flip();
        buffer.put(notBuffer);
        buffer.putLong( Long.MAX_VALUE );
        buffer.flip();
       
        fle.manager.recvQueue.add(new Message(buffer, 2));
        Notification n = fle.recvqueue.take();
        Assert.assertTrue("Wrong state", n.state == ServerState.LOOKING);
        Assert.assertTrue("Wrong leader", n.leader == 2);
        Assert.assertTrue("Wrong zxid", n.zxid == 0x1);
        Assert.assertTrue("Wrong epoch", n.electionEpoch == 1);
View Full Code Here

                return new Vote(proposedLeader, proposedZxid, proposedEpoch);
            }
           
            public void run() {

                Message response;
                while (!stop) {
                    // Sleeps on receive
                    try{
                        response = manager.pollRecvQueue(3000, TimeUnit.MILLISECONDS);
                        if(response == null) continue;
View Full Code Here

            LOG.error("Null listener when initializing cnx manager");
        }

        cnxManager.toSend(new Long(0), createMsg(ServerState.LOOKING.ordinal(), 1, -1, 1));

        Message m = null;
        int numRetries = 1;
        while((m == null) && (numRetries++ <= THRESHOLD)){
            m = cnxManager.pollRecvQueue(3000, TimeUnit.MILLISECONDS);
            if(m == null) cnxManager.connectAll();
        }
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.server.quorum.QuorumCnxManager.Message

Copyright © 2018 www.massapicom. 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.