Skip to content
Permalink
Browse files

[JENKINS-22941] AsynchronousExecution.blocksRestart

  • Loading branch information
jglick committed Mar 24, 2015
1 parent ae24ba1 commit 285b4501470f321086bcca4f98c871f2d5b6d418
@@ -78,7 +78,7 @@
import jenkins.model.Jenkins;
import jenkins.model.lazy.BuildReference;
import jenkins.model.lazy.LazyBuildMixIn;
import jenkins.model.queue.Executable2;
import jenkins.model.queue.AsynchronousExecution;
import jenkins.util.Timer;
import org.jenkinsci.plugins.workflow.actions.LogAction;
import org.jenkinsci.plugins.workflow.flow.FlowDefinition;
@@ -96,7 +96,7 @@

@SuppressWarnings("SynchronizeOnNonFinalField")
@edu.umd.cs.findbugs.annotations.SuppressWarnings("JLM_JSR166_UTILCONCURRENT_MONITORENTER") // completed is an unusual usage
public final class WorkflowRun extends Run<WorkflowJob,WorkflowRun> implements Executable2, LazyBuildMixIn.LazyLoadingRun<WorkflowJob,WorkflowRun> {
public final class WorkflowRun extends Run<WorkflowJob,WorkflowRun> implements Queue.Executable, LazyBuildMixIn.LazyLoadingRun<WorkflowJob,WorkflowRun> {

private static final Logger LOGGER = Logger.getLogger(WorkflowRun.class.getName());

@@ -212,6 +212,11 @@ private AsynchronousExecution sleep() {
}
getExecutor().recordCauseOfInterruption(WorkflowRun.this, listener);
}
@Override public boolean blocksRestart() {
// TODO check whether the CPS VM thread is active
// (and make it stop scheduling things when Jenkins.isQuietingDown())
return false;
}
};
final AtomicReference<ScheduledFuture<?>> copyLogsTask = new AtomicReference<ScheduledFuture<?>>();
copyLogsTask.set(Timer.get().scheduleAtFixedRate(new Runnable() {
@@ -36,6 +36,7 @@
import java.util.logging.Logger;
import javax.annotation.CheckForNull;
import jenkins.model.Jenkins;
import jenkins.model.queue.AsynchronousExecution;
import jenkins.util.Timer;
import org.acegisecurity.Authentication;
import org.jenkinsci.plugins.durabletask.executors.ContinuableExecutable;
@@ -54,7 +55,6 @@
import static java.util.logging.Level.*;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import jenkins.model.queue.Executable2;

public class ExecutorStepExecution extends AbstractStepExecutionImpl {

@@ -135,7 +135,7 @@ public void stop(Throwable cause) {
private static final class RunningTask {
final @Nonnull StepContext context;
/** null until placeholder executable runs */
@Nullable Executable2.AsynchronousExecution execution;
@Nullable AsynchronousExecution execution;
/** null until placeholder executable runs */
@Nullable Launcher launcher;
RunningTask(StepContext context) {
@@ -389,7 +389,7 @@ AccessControlled accessControlled() {
/**
* Occupies {@link Executor} while workflow uses this slave.
*/
private final class PlaceholderExecutable implements ContinuableExecutable, Executable2 {
private final class PlaceholderExecutable implements ContinuableExecutable {

@Override public void run() {
final TaskListener listener;
@@ -464,6 +464,9 @@ AccessControlled accessControlled() {
// TODO save the BodyExecution somehow and call .cancel() here; currently you need to Executor.doStop the WorkflowRun as a whole, which is inconvenient
super.getExecutor().recordCauseOfInterruption(r, listener);
}
@Override public boolean blocksRestart() {
return false;
}
};
throw runningTask.execution;
}

0 comments on commit 285b450

Please sign in to comment.
You can’t perform that action at this time.