@Override public void cancelJob(@Nullable JobListener jobListener) throws JobException { this.jobLauncher.cancelJob(jobListener); }
@Override public boolean cancel(boolean mayInterruptIfRunning) { if (!cancelRequested) { return false; } boolean result = true; try { jobLauncher.cancelJob(jobListener); } catch (JobException e) { LOG.error("Failed to cancel job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e); result = false; } if (mayInterruptIfRunning) { result &= future.cancel(true); } return result; }
@Override public void run() { try { Thread.sleep(500); jobLauncher.cancelJob(null); isCancelled.set(true); } catch (Exception je) { // Ignored } } });
@Override public boolean cancel(boolean mayInterruptIfRunning) { // FIXME there is a race condition here as the job may complete successfully before we // call cancelJob() below. There isn't an easy way to fix that right now. RunningState runState = fetchRunningState(); if (runState.isCancelled()) { return true; } else if (runState.isDone()) { return false; } try { // No special processing of callbacks necessary getLegacyLauncher().cancelJob(new AbstractJobListener(){}); } catch (JobException e) { throw new RuntimeException("Unable to cancel job " + _jobSpec + ": " + e, e); } return super.cancel(mayInterruptIfRunning); }
@Override public void cancelJob(@Nullable JobListener jobListener) throws JobException { this.jobLauncher.cancelJob(jobListener); }
@Override public boolean cancel(boolean mayInterruptIfRunning) { if (!cancelRequested) { return false; } boolean result = true; try { jobLauncher.cancelJob(jobListener); } catch (JobException e) { LOG.error("Failed to cancel job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e); result = false; } if (mayInterruptIfRunning) { result &= future.cancel(true); } return result; }
@Override public boolean cancel(boolean mayInterruptIfRunning) { // FIXME there is a race condition here as the job may complete successfully before we // call cancelJob() below. There isn't an easy way to fix that right now. RunningState runState = fetchRunningState(); if (runState.isCancelled()) { return true; } else if (runState.isDone()) { return false; } try { // No special processing of callbacks necessary getLegacyLauncher().cancelJob(new AbstractJobListener(){}); } catch (JobException e) { throw new RuntimeException("Unable to cancel job " + _jobSpec + ": " + e, e); } return super.cancel(mayInterruptIfRunning); }