NIOServerCnxn.java 文件源码

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

项目:bigstreams 作者:
public NIOServerCnxn(ZooKeeperServer zk, SocketChannel sock,
        SelectionKey sk, NIOServerCnxnFactory factory) throws IOException {
    this.zkServer = zk;
    this.sock = sock;
    this.sk = sk;
    this.factory = factory;
    if (zk != null) { 
        outstandingLimit = zk.getGlobalOutstandingLimit();
    }
    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();
    authInfo.add(new Id("ip", addr.getHostAddress()));
    sk.interestOps(SelectionKey.OP_READ);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号