Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-4184

Why org.apache.zookeeper.ClientCnxnSocketNIO#cleanup will sleep 100ms.

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • None
    • None
    • java client
    • None

    Description

      Hi, I notice the code as follow:

      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;
      }

      I want to know why there sleep 100ms.

      Attachments

        Activity

          People

            Unassigned Unassigned
            horizonzy Yan Zhao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: