Java 类org.apache.zookeeper.ClientCnxn 实例源码

项目:fuck_zookeeper    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:fuck_zookeeper    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:fuck_zookeeper    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:https-github.com-apache-zookeeper    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:https-github.com-apache-zookeeper    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:https-github.com-apache-zookeeper    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:ZooKeeper    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:ZooKeeper    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:ZooKeeper    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:StreamProcessingInfrastructure    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:StreamProcessingInfrastructure    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:StreamProcessingInfrastructure    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:bigstreams    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:bigstreams    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:bigstreams    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:zookeeper-src-learning    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:zookeeper-src-learning    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:zookeeper-src-learning    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:zookeeper    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:zookeeper    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:zookeeper    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:SecureKeeper    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:SecureKeeper    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:SecureKeeper    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:SecureKeeper    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:SecureKeeper    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:SecureKeeper    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:StreamBench    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:StreamBench    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:StreamBench    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:ACaZoo    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:ACaZoo    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:ACaZoo    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:curator    文件:InjectSessionExpiration.java   
public static void injectSessionExpiration(ZooKeeper zooKeeper)
{
    try
    {
        WatchedEvent event = new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.Expired, null);

        ClientCnxn clientCnxn = (ClientCnxn)cnxnField.get(zooKeeper);
        Object eventThread = eventThreadField.get(clientCnxn);
        queueEventMethod.invoke(eventThread, event);
        queueEventOfDeathMethod.invoke(eventThread);
        stateField.set(clientCnxn, ZooKeeper.States.CLOSED);
        Object sendThread = sendThreadField.get(clientCnxn);
        Object clientCnxnSocket = getClientCnxnSocketMethod.invoke(sendThread);
        wakeupCnxnMethod.invoke(clientCnxnSocket);
    }
    catch ( ReflectiveOperationException e )
    {
        throw new RuntimeException("Could not inject session expiration using reflection", e);
    }
}
项目:LoadBalanced_zk    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:LoadBalanced_zk    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:LoadBalanced_zk    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}
项目:LoadBalanced_zk    文件:ZooKeeperSaslClient.java   
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
    // processResult() is used by ClientCnxn's sendThread to respond to
    // data[] contains the Zookeeper Server's SASL token.
    // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
    // to reply to the Zookeeper Server's SASL token
    ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
    if (client == null) {
        LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
        return;
    }
    byte[] usedata = data;
    if (data != null) {
        LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
    }
    else {
        usedata = new byte[0];
        LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
    }
    client.respondToServer(usedata, (ClientCnxn)ctx);
}
项目:LoadBalanced_zk    文件:ZooKeeperSaslClient.java   
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
  throws SaslException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
    }

    GetSASLRequest request = new GetSASLRequest();
    request.setToken(saslToken);
    SetSASLResponse response = new SetSASLResponse();
    ServerSaslResponseCallback cb = new ServerSaslResponseCallback();

    try {
        cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
    } catch (IOException e) {
        throw new SaslException("Failed to send SASL packet to server.",
            e);
    }
}
项目:LoadBalanced_zk    文件:ZooKeeperSaslClient.java   
public void initialize(ClientCnxn cnxn) throws SaslException {
    if (saslClient == null) {
        saslState = SaslState.FAILED;
        throw new SaslException("saslClient failed to initialize properly: it's null.");
    }
    if (saslState == SaslState.INITIAL) {
        if (saslClient.hasInitialResponse()) {
            sendSaslPacket(cnxn);
        }
        else {
            byte[] emptyToken = new byte[0];
            sendSaslPacket(emptyToken, cnxn);
        }
        saslState = SaslState.INTERMEDIATE;
    }
}