Package org.apache.zookeeper_voltpatches.proto

Examples of org.apache.zookeeper_voltpatches.proto.ConnectResponse


            LOG.warn("Failed to register with JMX", e);
            jmxConnectionBean = null;
        }

        try {
            ConnectResponse rsp = new ConnectResponse(0, valid ? sessionTimeout
                    : 0, valid ? sessionId : 0, // send 0 if session is no
                    // longer valid
                    valid ? zk.generatePasswd(sessionId) : new byte[16]);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            BinaryOutputArchive bos = BinaryOutputArchive.getArchive(baos);
            bos.writeInt(-1, "len");
            rsp.serialize(bos, "connect");
            baos.close();
            ByteBuffer bb = ByteBuffer.wrap(baos.toByteArray());
            bb.putInt(bb.remaining() - 4).rewind();
            sendBuffer(bb);
View Full Code Here


        void readConnectResult() throws IOException {
            ByteBufferInputStream bbis = new ByteBufferInputStream(
                    incomingBuffer);
            BinaryInputArchive bbia = BinaryInputArchive.getArchive(bbis);
            ConnectResponse conRsp = new ConnectResponse();
            conRsp.deserialize(bbia, "connect");
            negotiatedSessionTimeout = conRsp.getTimeOut();
            if (negotiatedSessionTimeout <= 0) {
                zooKeeper.state = States.CLOSED;

                eventThread.queueEvent(new WatchedEvent(
                        Watcher.Event.EventType.None,
                        Watcher.Event.KeeperState.Expired, null));
                eventThread.queueEventOfDeath();
                throw new SessionExpiredException(
                        "Unable to reconnect to ZooKeeper service, session 0x"
                                + Long.toHexString(sessionId) + " has expired");
            }
            readTimeout = negotiatedSessionTimeout * 2 / 3;
            connectTimeout = negotiatedSessionTimeout / serverAddrs.size();
            sessionId = conRsp.getSessionId();
            sessionPasswd = conRsp.getPasswd();
            zooKeeper.state = States.CONNECTED;
            LOG.info("Session establishment complete on server "
                    + ((SocketChannel) sockKey.channel()).socket()
                            .getRemoteSocketAddress() + ", sessionid = 0x"
                    + Long.toHexString(sessionId) + ", negotiated timeout = "
View Full Code Here

  }
  public int compareTo (Object peer_) throws ClassCastException {
    if (!(peer_ instanceof ConnectResponse)) {
      throw new ClassCastException("Comparing different types of records.");
    }
    ConnectResponse peer = (ConnectResponse) peer_;
    int ret = 0;
    ret = (protocolVersion == peer.protocolVersion)? 0 :((protocolVersion<peer.protocolVersion)?-1:1);
    if (ret != 0) return ret;
    ret = (timeOut == peer.timeOut)? 0 :((timeOut<peer.timeOut)?-1:1);
    if (ret != 0) return ret;
View Full Code Here

      return false;
    }
    if (peer_ == this) {
      return true;
    }
    ConnectResponse peer = (ConnectResponse) peer_;
    boolean ret = false;
    ret = (protocolVersion==peer.protocolVersion);
    if (!ret) return ret;
    ret = (timeOut==peer.timeOut);
    if (!ret) return ret;
View Full Code Here

TOP

Related Classes of org.apache.zookeeper_voltpatches.proto.ConnectResponse

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.