private long closeSuccessBatchHandler()

in src/main/java/com/aliyun/openservices/aliyun/log/producer/LogProducer.java [518:535]


  private long closeSuccessBatchHandler(long timeoutMs)
      throws InterruptedException, ProducerException {
    long startMs = System.currentTimeMillis();
    successBatchHandler.close();
    boolean invokedFromCallback = Thread.currentThread() == this.successBatchHandler;
    if (invokedFromCallback) {
      LOGGER.warn(
          "Skip join success batch handler since you have incorrectly invoked close from the producer call-back");
      return timeoutMs;
    }
    successBatchHandler.join(timeoutMs);
    if (successBatchHandler.isAlive()) {
      LOGGER.warn("The success batch handler thread is still alive");
      throw new ProducerException("the success batch handler thread is still alive");
    }
    long nowMs = System.currentTimeMillis();
    return Math.max(0, timeoutMs - nowMs + startMs);
  }