Example usage for java.util.concurrent ScheduledThreadPoolExecutor remove

List of usage examples for java.util.concurrent ScheduledThreadPoolExecutor remove

Introduction

In this page you can find the example usage for java.util.concurrent ScheduledThreadPoolExecutor remove.

Prototype

public boolean remove(Runnable task) 

Source Link

Document

Removes this task from the executor's internal queue if it is present, thus causing it not to be run if it has not already started.

Usage

From source file:org.codinjutsu.tools.jenkins.view.BrowserPanel.java

public void initScheduledJobs() {
    final ExecutorService executorService = ExecutorService.getInstance(project);
    final ScheduledThreadPoolExecutor executor = executorService.getExecutor();
    executorService.safeTaskCancel(refreshViewFutureTask);
    executor.remove(refreshViewJob);

    if (jenkinsAppSettings.isServerUrlSet() && jenkinsAppSettings.getJobRefreshPeriod() > 0) {
        refreshViewFutureTask = executor.scheduleWithFixedDelay(refreshViewJob,
                jenkinsAppSettings.getJobRefreshPeriod(), jenkinsAppSettings.getJobRefreshPeriod(),
                TimeUnit.MINUTES);
    }// w  w w.  java  2s. c o m
}