You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "赵延 (Jira)" <ji...@apache.org> on 2021/01/19 13:06:00 UTC

[jira] [Created] (ZOOKEEPER-4184) Why org.apache.zookeeper.ClientCnxnSocketNIO#cleanup will sleep 100ms.

赵延 created ZOOKEEPER-4184:
-----------------------------

             Summary: Why org.apache.zookeeper.ClientCnxnSocketNIO#cleanup will sleep 100ms.
                 Key: ZOOKEEPER-4184
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4184
             Project: ZooKeeper
          Issue Type: Wish
          Components: java client
            Reporter: 赵延


Hi, I notice the code as follow:
{code:java}
void cleanup() {
    if (sockKey != null) {
        SocketChannel sock = (SocketChannel) sockKey.channel();
        sockKey.cancel();
        try {
            sock.socket().shutdownInput();
        } catch (IOException e) {
            LOG.debug("Ignoring exception during shutdown input", e);
        }
        try {
            sock.socket().shutdownOutput();
        } catch (IOException e) {
            LOG.debug("Ignoring exception during shutdown output", e);
        }
        try {
            sock.socket().close();
        } catch (IOException e) {
            LOG.debug("Ignoring exception during socket close", e);
        }
        try {
            sock.close();
        } catch (IOException e) {
            LOG.debug("Ignoring exception during channel close", e);
        }
    }
    try {
        Thread.sleep(100);
    } catch (InterruptedException e) {
        LOG.debug("SendThread interrupted during sleep, ignoring");
    }
    sockKey = null;
}{code}
I want to know why there sleep 100ms.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)