当前位置: 首页>>代码示例>>Java>>正文


Java ClientCnxn.enableWrite方法代码示例

本文整理汇总了Java中org.apache.zookeeper.ClientCnxn.enableWrite方法的典型用法代码示例。如果您正苦于以下问题:Java ClientCnxn.enableWrite方法的具体用法?Java ClientCnxn.enableWrite怎么用?Java ClientCnxn.enableWrite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.zookeeper.ClientCnxn的用法示例。


在下文中一共展示了ClientCnxn.enableWrite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: respondToServer

import org.apache.zookeeper.ClientCnxn; //导入方法依赖的package包/类
public void respondToServer(byte[] serverToken, ClientCnxn cnxn) {
    if (saslClient == null) {
        LOG.error("saslClient is unexpectedly null. Cannot respond to server's SASL message; ignoring.");
        return;
    }

    if (!(saslClient.isComplete())) {
        try {
            saslToken = createSaslToken(serverToken);
            if (saslToken != null) {
                sendSaslPacket(saslToken, cnxn);
            }
        } catch (SaslException e) {
            LOG.error("SASL authentication failed using login context '" +
                    this.getLoginContext() + "'.");
            saslState = SaslState.FAILED;
            gotLastPacket = true;
        }
    }

    if (saslClient.isComplete()) {
        // GSSAPI: server sends a final packet after authentication succeeds
        // or fails.
        if ((serverToken == null) && (saslClient.getMechanismName().equals("GSSAPI")))
            gotLastPacket = true;
        // non-GSSAPI: no final packet from server.
        if (!saslClient.getMechanismName().equals("GSSAPI")) {
            gotLastPacket = true;
        }
        // SASL authentication is completed, successfully or not:
        // enable the socket's writable flag so that any packets waiting for authentication to complete in
        // the outgoing queue will be sent to the Zookeeper server.
        cnxn.enableWrite();
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:36,代码来源:ZooKeeperSaslClient.java

示例2: respondToServer

import org.apache.zookeeper.ClientCnxn; //导入方法依赖的package包/类
public void respondToServer(byte[] serverToken, ClientCnxn cnxn) {
    if (saslClient == null) {
        LOG.error("saslClient is unexpectedly null. Cannot respond to server's SASL message; ignoring.");
        return;
    }

    if (!(saslClient.isComplete())) {
        try {
            saslToken = createSaslToken(serverToken);
            if (saslToken != null) {
                sendSaslPacket(saslToken, cnxn);
            }
        } catch (SaslException e) {
            LOG.error("SASL authentication failed using login context '" +
                    this.getLoginContext() + "'.");
            saslState = SaslState.FAILED;
            gotLastPacket = true;
        }
    }

    if (saslClient.isComplete()) {
        // GSSAPI: server sends a final packet after authentication succeeds
        // or fails.
        if ((serverToken == null) && (saslClient.getMechanismName() == "GSSAPI"))
            gotLastPacket = true;
        // non-GSSAPI: no final packet from server.
        if (saslClient.getMechanismName() != "GSSAPI") {
            gotLastPacket = true;
        }
        // SASL authentication is completed, successfully or not:
        // enable the socket's writable flag so that any packets waiting for authentication to complete in
        // the outgoing queue will be sent to the Zookeeper server.
        cnxn.enableWrite();
    }
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:36,代码来源:ZooKeeperSaslClient.java


注:本文中的org.apache.zookeeper.ClientCnxn.enableWrite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。