Skip to content

Commit

Permalink
[JENKINS-26137] Pass pickleFactories directly into the RiverWriter co…
Browse files Browse the repository at this point in the history
…nstructor.
  • Loading branch information
jglick committed Mar 24, 2017
1 parent c2de116 commit 6012a82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 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.24</version>
<version>2.25</version>
<relativePath />
</parent>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down Expand Up @@ -67,7 +67,7 @@
<no-test-jar>false</no-test-jar>
<git-plugin.version>3.0.5</git-plugin.version>
<workflow-scm-step-plugin.version>2.4</workflow-scm-step-plugin.version>
<workflow-support-plugin.version>2.13</workflow-support-plugin.version>
<workflow-support-plugin.version>2.14-20170324.021801-1</workflow-support-plugin.version> <!-- TODO https://github.com/jenkinsci/workflow-support-plugin/pull/35 -->
</properties>
<dependencies>
<dependency>
Expand Down
Expand Up @@ -48,6 +48,7 @@
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand All @@ -66,6 +67,7 @@
import javax.annotation.CheckForNull;
import static org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.*;
import static org.jenkinsci.plugins.workflow.cps.persistence.PersistenceContext.*;
import org.jenkinsci.plugins.workflow.pickles.PickleFactory;

/**
* List of {@link CpsThread}s that form a single {@link CpsFlowExecution}.
Expand Down Expand Up @@ -441,14 +443,15 @@ public void saveProgram(File f) throws IOException {
CpsFlowExecution old = PROGRAM_STATE_SERIALIZATION.get();
PROGRAM_STATE_SERIALIZATION.set(execution);

if (Jenkins.getInstance() == null) {
LOGGER.log(WARNING, "Skipping save to {0} since Jenkins seems to be shutting down", f);
Collection<? extends PickleFactory> pickleFactories = PickleFactory.all();
if (pickleFactories.isEmpty()) {
LOGGER.log(WARNING, "Skipping save to {0} since Jenkins seems to be either starting up or shutting down", f);
return;
}

boolean serializedOK = false;
try {
RiverWriter w = new RiverWriter(tmpFile, execution.getOwner());
RiverWriter w = new RiverWriter(tmpFile, execution.getOwner(), pickleFactories);
try {
w.writeObject(this);
} finally {
Expand Down

0 comments on commit 6012a82

Please sign in to comment.