code: void closeChannel(final Channel channel) {
          synchronized (channelClosing) {
              if (closingChannel.contains(channel)) {
                  LOG.info(channel.toString() + " has already been closed");
                  return;
              }
  
              closingChannel.add(channel);
          }
  
          LOG.debug(channel.toString() + " begin to close");
          ChannelFuture closeFuture = channel.close();
          closeFuture.addListener(new ChannelFutureListener() {
              public void operationComplete(ChannelFuture future) throws Exception {
  
                  synchronized (channelClosing) {
                      closingChannel.remove(channel);
                  }
                  LOG.debug(channel.toString() + " closed.");
              }
          });
      }
docs: Avoid channel double close