Skip to content

Commit 1fcd4ad

Browse files
authored
Merge pull request #417 from jglick/StepExecution.acceptAll
Using `StepExecution.acceptAll`
2 parents 109f3e7 + e803ce8 commit 1fcd4ad

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@
8383
<scope>import</scope>
8484
<type>pom</type>
8585
</dependency>
86+
<!-- TODO until in BOM: -->
87+
<dependency>
88+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
89+
<artifactId>workflow-step-api</artifactId>
90+
<version>686.v603d058a_e148</version>
91+
</dependency>
8692
</dependencies>
8793
</dependencyManagement>
8894
<dependencies>

src/main/java/org/jenkinsci/plugins/workflow/steps/durable_task/DurableTaskStep.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -762,12 +762,11 @@ private static class HandlerImpl extends Handler {
762762

763763
private void check(Computer c) {
764764
String name = c.getName();
765-
StepExecution.applyAll(Execution.class, exec -> {
765+
StepExecution.acceptAll(Execution.class, exec -> {
766766
if (exec.watching && exec.node.equals(name)) {
767767
LOGGER.fine(() -> "Online/offline event on " + name + ", checking current status of " + exec.remote + " soon");
768768
threadPool().schedule(exec::check, 15, TimeUnit.SECONDS);
769769
}
770-
return null;
771770
});
772771
}
773772

src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public void stop(@NonNull Throwable cause) throws Exception {
331331
}
332332
Set<StepContext> newAnomalous = new HashSet<>();
333333
Set<String> affectedNodes = new HashSet<>();
334-
StepExecution.applyAll(ExecutorStepExecution.class, exec -> {
334+
StepExecution.acceptAll(ExecutorStepExecution.class, exec -> {
335335
StepContext ctx = exec.getContext();
336336
if (!knownTasks.contains(ctx)) {
337337
LOGGER.warning(() -> "do not know about " + ctx);
@@ -351,11 +351,10 @@ public void stop(@NonNull Throwable cause) throws Exception {
351351
} else {
352352
LOGGER.fine(() -> "know about " + ctx);
353353
}
354-
return null;
355354
}).get();
356355
// Also abort any shell steps running on the same node(s):
357356
if (!affectedNodes.isEmpty()) {
358-
StepExecution.applyAll(DurableTaskStep.Execution.class, exec -> {
357+
StepExecution.acceptAll(DurableTaskStep.Execution.class, exec -> {
359358
if (affectedNodes.contains(exec.node)) {
360359
StepContext ctx = exec.getContext();
361360
try {
@@ -365,7 +364,6 @@ public void stop(@NonNull Throwable cause) throws Exception {
365364
}
366365
ctx.onFailure(new FlowInterruptedException(Result.ABORTED, false, new RemovedNodeCause()));
367366
}
368-
return null;
369367
});
370368
}
371369
for (StepContext ctx : newAnomalous) {

0 commit comments

Comments
 (0)