本文整理了Java中java.util.concurrent.ScheduledFuture.cancel()
方法的一些代码示例,展示了ScheduledFuture.cancel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScheduledFuture.cancel()
方法的具体详情如下:
包路径:java.util.concurrent.ScheduledFuture
类名称:ScheduledFuture
方法名:cancel
暂无
代码示例来源:origin: apache/incubator-dubbo
void cancelRetryTask() {
retryScheduledFuture.cancel(false);
retryExecutor.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: 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: apache/hive
private void stop() {
if (pollFuture != null) {
pollFuture.cancel(true);
pollFuture = null;
}
if (executorService != null) {
executorService.shutdown();
executorService = null;
}
}
代码示例来源: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: ltsopensource/light-task-scheduler
@Override
public void call() throws Exception {
scheduledFuture.cancel(true);
LOAD_EXECUTOR_SERVICE.shutdown();
start.set(false);
}
});
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public void call() throws Exception {
scheduledFuture.cancel(true);
LOAD_EXECUTOR_SERVICE.shutdown();
start.set(false);
}
});
代码示例来源:origin: apache/incubator-shardingsphere
@Override
public void close() {
for (KeepAliveTask keepAliveTask: keepAliveTasks.values()) {
keepAliveTask.close();
}
keepAliveTasks.clear();
scheduledService.shutdown();
scheduledFuture.cancel(false);
}
代码示例来源:origin: square/okhttp
public void failWebSocket(Exception e, @Nullable Response response) {
Streams streamsToClose;
synchronized (this) {
if (failed) return; // Already failed.
failed = true;
streamsToClose = this.streams;
this.streams = null;
if (cancelFuture != null) cancelFuture.cancel(false);
if (executor != null) executor.shutdown();
}
try {
listener.onFailure(this, e, response);
} finally {
closeQuietly(streamsToClose);
}
}
代码示例来源:origin: apache/nifi
@Override
public void stop() {
if(taskExecutor != null) {
logger.debug("Stopping Http Site-to-Site Transaction Maintenance task...");
taskExecutor.shutdown();
}
if (transactionMaintenanceTask != null) {
logger.debug("Stopping transactionMaintenanceTask...");
transactionMaintenanceTask.cancel(true);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
public void stop() {
try {
if (start.compareAndSet(true, false)) {
scheduledFuture.cancel(true);
channelCheckExecutorService.shutdown();
offlineTaskTrackerScheduledFuture.cancel(true);
offlineTaskTrackerCheckExecutorService.shutdown();
}
LOGGER.info("Stop channel manager success!");
} catch (Throwable t) {
LOGGER.error("Stop channel manager failed!", t);
}
}
代码示例来源:origin: square/okhttp
@Override public void onReadClose(int code, String reason) {
if (code == -1) throw new IllegalArgumentException();
Streams toClose = null;
synchronized (this) {
if (receivedCloseCode != -1) throw new IllegalStateException("already closed");
receivedCloseCode = code;
receivedCloseReason = reason;
if (enqueuedClose && messageAndCloseQueue.isEmpty()) {
toClose = this.streams;
this.streams = null;
if (cancelFuture != null) cancelFuture.cancel(false);
this.executor.shutdown();
}
}
try {
listener.onClosing(this, code, reason);
if (toClose != null) {
listener.onClosed(this, code, reason);
}
} finally {
closeQuietly(toClose);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
public void stop() {
try {
if (start.compareAndSet(true, false)) {
scheduledFuture.cancel(true);
channelCheckExecutorService.shutdown();
offlineTaskTrackerScheduledFuture.cancel(true);
offlineTaskTrackerCheckExecutorService.shutdown();
}
LOGGER.info("Stop channel manager success!");
} catch (Throwable t) {
LOGGER.error("Stop channel manager failed!", t);
}
}
代码示例来源:origin: apache/nifi
private void stopExtendingTtl() {
if (!ttlExtendTaskExecutor.isShutdown()) {
ttlExtendTaskExecutor.shutdown();
}
if (ttlExtendingFuture != null && !ttlExtendingFuture.isCancelled()) {
logger.debug("Cancelling extending ttl...");
ttlExtendingFuture.cancel(true);
}
closeSilently(extendingApiClient);
}
代码示例来源:origin: apache/nifi
@Override
public void close() throws IOException {
if (checkpointFuture != null) {
checkpointFuture.cancel(false);
}
checkpointExecutor.shutdown();
wal.shutdown();
}
代码示例来源:origin: ltsopensource/light-task-scheduler
public void stop() {
try {
if (start.compareAndSet(true, false)) {
scheduledFuture.cancel(true);
FIXED_EXECUTOR_SERVICE.shutdown();
}
LOGGER.info("Executable dead job checker stopped!");
} catch (Throwable t) {
LOGGER.error("Executable dead job checker stop failed!", t);
}
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
public void stop() {
try {
if (start.compareAndSet(true, false)) {
scheduledFuture.cancel(true);
FIXED_EXECUTOR_SERVICE.shutdown();
}
LOGGER.info("Executable dead job checker stopped!");
} catch (Throwable t) {
LOGGER.error("Executable dead job checker stop failed!", t);
}
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
public void stop() {
try {
if (start.compareAndSet(true, false)) {
scheduledFuture.cancel(true);
FIXED_EXECUTOR_SERVICE.shutdown();
}
LOGGER.info("Executing dead job checker stopped!");
} catch (Throwable t) {
LOGGER.error("Executing dead job checker stop failed!", t);
}
}
内容来源于网络,如有侵权,请联系作者删除!