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

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

    XMLWordPrintableJSON

    Details

    • Type: Wish
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: java client
    • Labels:
      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

            • Assignee:
              Unassigned
              Reporter:
              horizonzy 赵延
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: