public void close() throws IOException {
   if (isShuttingDown.compareAndSet(false, true)) {
     logger.info("ZkConsumerConnector shutting down");
     try {
       scheduler.shutdown();
       if (fetcher != null) {
         fetcher.stopConnectionsToAllBrokers();
       }
       sendShutdownToAllQueues();
       if (config.isAutoCommit()) {
         commitOffsets();
       }
       // waiting rebalance listener to closed and then shutdown the zkclient
       for (ZKRebalancerListener<?> listener : this.rebalancerListeners) {
         Closer.closeQuietly(listener);
       }
       if (this.zkClient != null) {
         this.zkClient.close();
         zkClient = null;
       }
     } catch (Exception e) {
       logger.error("error during consumer connector shutdown", e);
     }
     logger.info("ZkConsumerConnector shut down completed");
   }
 }
  public ZookeeperConsumerConnector(ConsumerConfig config, boolean enableFetcher) {
    Xnd.logConsumer("创建ZookeeperConsumerConnector连接对象");
    this.config = config;
    this.enableFetcher = enableFetcher;
    //
    this.topicRegistry = new Pool<String, Pool<Partition, PartitionTopicInfo>>();
    this.queues = new Pool<StringTuple, BlockingQueue<FetchedDataChunk>>();
    //
    connectZk();

    createFetcher();
    if (this.config.isAutoCommit()) {
      logger.info("starting auto committer every " + config.getAutoCommitIntervalMs() + " ms");
      Xnd.logConsumer("启动自动commit任务");
      scheduler.scheduleWithRate(
          new AutoCommitTask(), config.getAutoCommitIntervalMs(), config.getAutoCommitIntervalMs());
    }
  }