Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-26148] Using default implementation of StepExecution.stop.
  • Loading branch information
jglick committed Sep 4, 2017
1 parent 616e3ad commit eb26612
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 46 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -28,7 +28,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.31</version>
<version>2.33</version>
<relativePath />
</parent>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down Expand Up @@ -73,7 +73,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>2.10</version>
<version>2.13-20170904.014626-1</version> <!-- TODO https://github.com/jenkinsci/workflow-step-api-plugin/pull/30 -->
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down
Expand Up @@ -54,13 +54,6 @@ public boolean start() throws Exception {
return false;
}

@Override
public void stop(Throwable cause) throws Exception {
// noop
//
// the head of the CPS thread that's executing the body should stop and that's all we need to do.
}

private static final long serialVersionUID = 1L;

}
Expand Up @@ -8,14 +8,11 @@
import org.jenkinsci.plugins.workflow.cps.CpsThread;
import org.jenkinsci.plugins.workflow.cps.persistence.PersistIn;
import org.jenkinsci.plugins.workflow.cps.steps.ParallelStep.ResultHandler;
import org.jenkinsci.plugins.workflow.steps.BodyExecution;
import org.jenkinsci.plugins.workflow.steps.StepContext;
import org.jenkinsci.plugins.workflow.steps.StepExecution;

import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;

import static org.jenkinsci.plugins.workflow.cps.persistence.PersistenceContext.FLOW_NODE;
Expand All @@ -28,8 +25,6 @@
class ParallelStepExecution extends StepExecution {
private transient ParallelStep parallelStep;

private final List<BodyExecution> bodies = new ArrayList<BodyExecution>();

public ParallelStepExecution(ParallelStep parallelStep, StepContext context) {
super(context);
this.parallelStep = parallelStep;
Expand All @@ -50,23 +45,15 @@ public boolean start() throws Exception {
ResultHandler r = new ResultHandler(cps, this, parallelStep.isFailFast());

for (Entry<String,Closure> e : parallelStep.closures.entrySet()) {
BodyExecution body = cps.newBodyInvoker(t.getGroup().export(e.getValue()))
cps.newBodyInvoker(t.getGroup().export(e.getValue()))
.withStartAction(new ParallelLabelAction(e.getKey()))
.withCallback(r.callbackFor(e.getKey()))
.start();
bodies.add(body);
}

return false;
}

@Override
public void stop(Throwable cause) throws Exception {
for (BodyExecution body : bodies) {
body.cancel(cause);
}
}

private static final long serialVersionUID = 1L;

@PersistIn(FLOW_NODE)
Expand Down
Expand Up @@ -89,7 +89,6 @@ public static class Execution extends AbstractStepExecutionImpl {
super.onResume();
value = "two";
}
@Override public void stop(Throwable cause) throws Exception {}
}
private static class ExpanderImpl extends EnvironmentExpander {
private static final long serialVersionUID = 1;
Expand Down
Expand Up @@ -103,10 +103,6 @@ private Object writeReplace() {
public boolean start() throws Exception {
return false;
}
@Override
public void stop(Throwable cause) throws Exception {
// nothing to do here
}
}
}

Expand Down
Expand Up @@ -6,7 +6,6 @@
import org.jenkinsci.plugins.workflow.cps.CpsFlowExecution;
import org.jenkinsci.plugins.workflow.flow.FlowExecution;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.jenkinsci.plugins.workflow.steps.AbstractStepExecutionImpl;
import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution;
import org.jenkinsci.plugins.workflow.steps.StepContextParameter;

Expand Down Expand Up @@ -39,9 +38,4 @@ protected Void run() throws Exception {
if (r!=r2 || n!=n2 || f!=f2) throw new AssertionError("What!?");
return null;
}

@Override
public void stop(Throwable cause) throws Exception {
// nothing to do here
}
}
Expand Up @@ -201,7 +201,6 @@ public static final class Execution extends AbstractStepExecutionImpl {
listener.getLogger().println("running as " + Jenkins.getAuthentication().getName() + " from " + Thread.currentThread().getName());
return false;
}
@Override public void stop(Throwable cause) throws Exception {}
@Override public void onResume() {
super.onResume();
try {
Expand Down
Expand Up @@ -125,11 +125,6 @@ public boolean start() throws Exception {
.start();
return false;
}

@Override
public void stop(@Nonnull Throwable cause) throws Exception {
throw new UnsupportedOperationException();
}
}

}
Expand Down
Expand Up @@ -55,8 +55,6 @@ public static final class Execution extends AbstractStepExecutionImpl {
return false;
}

@Override public void stop(Throwable cause) {}

}

@Extension public static class DescriptorImpl extends AbstractStepDescriptorImpl {
Expand Down
Expand Up @@ -61,10 +61,6 @@ public boolean start() throws Exception {

return true;
}

@Override
public void stop(Throwable cause) throws Exception {
}
}

private static final long serialVersionUID = 1L;
Expand Down

0 comments on commit eb26612

Please sign in to comment.