java.util.concurrent.ScheduledExecutorService.shutdown()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中java.util.concurrent.ScheduledExecutorService.shutdown()方法的一些代码示例,展示了ScheduledExecutorService.shutdown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScheduledExecutorService.shutdown()方法的具体详情如下:
包路径:java.util.concurrent.ScheduledExecutorService
类名称:ScheduledExecutorService
方法名:shutdown

ScheduledExecutorService.shutdown介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-dubbo

void cancelRetryTask() {
    retryScheduledFuture.cancel(false);
    retryExecutor.shutdown();
  }
}

代码示例来源:origin: square/okhttp

/**
 * For testing: force this web socket to release its threads.
 */
void tearDown() throws InterruptedException {
 if (cancelFuture != null) {
  cancelFuture.cancel(false);
 }
 executor.shutdown();
 executor.awaitTermination(10, TimeUnit.SECONDS);
}

代码示例来源:origin: apache/flink

void stop() {
  executor.shutdown();
  try {
    if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
      executor.shutdownNow();
    }
  } catch (InterruptedException ignored) {
    executor.shutdownNow();
  }
}

代码示例来源:origin: apache/storm

@Override
  public void close() {
    _pendingFlusher.shutdown();
    try {
      _pendingFlusher.awaitTermination(5, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
      throw new RuntimeException("Interrupted while awaiting flusher shutdown", e);
    }
  }
}

代码示例来源:origin: apache/incubator-dubbo

void cancelRetryTask() {
    retryScheduledFuture.cancel(false);
    retryExecutor.shutdown();
  }
}

代码示例来源:origin: apache/storm

@Override
public void shutdown() {
  executor.shutdown();
  try {
    if (!executor.awaitTermination(2, TimeUnit.SECONDS)) {
      executor.shutdownNow();
    }
  } catch (InterruptedException ie) {
    executor.shutdownNow();
    Thread.currentThread().interrupt();
  }
}

代码示例来源:origin: jamesdbloom/mockserver

public synchronized void shutdown() {
  if (scheduler != null) {
    scheduler.shutdown();
    try {
      scheduler.awaitTermination(500, MILLISECONDS);
    } catch (InterruptedException ignore) {
      // ignore interrupted exception
    }
    scheduler = null;
  }
}

代码示例来源:origin: prestodb/presto

/**
 * For testing: force this web socket to release its threads.
 */
void tearDown() throws InterruptedException {
 if (cancelFuture != null) {
  cancelFuture.cancel(false);
 }
 executor.shutdown();
 executor.awaitTermination(10, TimeUnit.SECONDS);
}

代码示例来源:origin: Alluxio/alluxio

@Override
public void close() {
 if (mGc != null) {
  mGc.cancel(true);
  mGc = null;
 }
 mExecutor.shutdown();
}

代码示例来源:origin: alibaba/jstorm

@Override
public void shutdown() {
  executor.shutdown();
  try {
    if (!executor.awaitTermination(2, TimeUnit.SECONDS)) {
      executor.shutdownNow();
    }
  } catch (InterruptedException ie) {
    executor.shutdownNow();
    Thread.currentThread().interrupt();
  }
}

代码示例来源:origin: apache/incubator-gobblin

/** Stop the service. */
 @Override
 protected void shutDown()
   throws Exception {
  this.scheduledExecutorPool.shutdown();
  this.scheduledExecutorPool.awaitTermination(TERMINATION_TIMEOUT, TimeUnit.SECONDS);
 }
}

代码示例来源:origin: com.squareup.okhttp3/okhttp

/**
 * For testing: force this web socket to release its threads.
 */
void tearDown() throws InterruptedException {
 if (cancelFuture != null) {
  cancelFuture.cancel(false);
 }
 executor.shutdown();
 executor.awaitTermination(10, TimeUnit.SECONDS);
}

代码示例来源:origin: apache/hive

private void stop() {
 if (pollFuture != null) {
  pollFuture.cancel(true);
  pollFuture = null;
 }
 if (executorService != null) {
  executorService.shutdown();
  executorService = null;
 }
}

代码示例来源:origin: apache/storm

public void shutdown() {
    LOG.debug("Shutting down WaterMarkEventGenerator");
    executorService.shutdown();

    try {
      if (!executorService.awaitTermination(2, TimeUnit.SECONDS)) {
        executorService.shutdownNow();
      }
    } catch (InterruptedException ie) {
      executorService.shutdownNow();
      Thread.currentThread().interrupt();
    }
  }
}

代码示例来源:origin: apache/incubator-gobblin

/** Stop the service. */
@Override
protected void shutDown() throws Exception {
 this.scheduledExecutor.shutdown();
 this.scheduledExecutor.awaitTermination(TERMINATION_TIMEOUT, TimeUnit.SECONDS);
}

代码示例来源:origin: ltsopensource/light-task-scheduler

@Override
  public void call() throws Exception {
    scheduledFuture.cancel(true);
    LOAD_EXECUTOR_SERVICE.shutdown();
    start.set(false);
  }
});

代码示例来源:origin: apache/storm

private void closeFlushScheduler() {
    if (flushScheduler != null) {
      flushScheduler.shutdown();
      try {
        if (!flushScheduler.awaitTermination(2, TimeUnit.SECONDS)) {
          flushScheduler.shutdownNow();
        }
      } catch (InterruptedException ie) {
        // (Re-)Cancel if current thread also interrupted
        flushScheduler.shutdownNow();
        // Preserve interrupt status
        Thread.currentThread().interrupt();
      }
    }
  }
}

代码示例来源:origin: internetarchive/heritrix3

public void stop() {
  executor.shutdown();
  try {
    while (!executor.awaitTermination(10, TimeUnit.SECONDS));
  } catch (InterruptedException e) {
    // do nothing
  }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

@Override
  public void call() throws Exception {
    scheduledFuture.cancel(true);
    LOAD_EXECUTOR_SERVICE.shutdown();
    start.set(false);
  }
});

代码示例来源:origin: azkaban/azkaban

public void shutdown() {
 this.scheduler.shutdown();
 try {
  if (!this.scheduler.awaitTermination(60, TimeUnit.SECONDS)) {
   this.scheduler.shutdownNow();
  }
 } catch (final InterruptedException ex) {
  this.scheduler.shutdownNow();
  Thread.currentThread().interrupt();
 }
}

相关文章