NIOServerCnxn.java 文件源码

java
阅读 39 收藏 0 点赞 0 评论 0

项目:https-github.com-apache-zookeeper 作者:
public NIOServerCnxn(ZooKeeperServer zk, SocketChannel sock,
                     SelectionKey sk, NIOServerCnxnFactory factory,
                     SelectorThread selectorThread) throws IOException {
    this.zkServer = zk;
    this.sock = sock;
    this.sk = sk;
    this.factory = factory;
    this.selectorThread = selectorThread;
    if (this.factory.login != null) {
        this.zooKeeperSaslServer = new ZooKeeperSaslServer(factory.login);
    }
    if (zk != null) {
        outstandingLimit = zk.getGlobalOutstandingLimit();
    } else {
        outstandingLimit = 1;
    }
    sock.socket().setTcpNoDelay(true);
    /* set socket linger to false, so that socket close does not block */
    sock.socket().setSoLinger(false, -1);
    InetAddress addr = ((InetSocketAddress) sock.socket()
            .getRemoteSocketAddress()).getAddress();
    addAuthInfo(new Id("ip", addr.getHostAddress()));
    this.sessionTimeout = factory.sessionlessCnxnTimeout;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号