Skip to content
Permalink
Browse files

[JENKINS-26761] Try using a PersistedList rather than a LinkedList fo…

…r new WorkflowRun.checkouts.

(Existing build records will continue to use LinkedList.) Possible advantages:
· If the bug was caused by an unreported failure to serialize/deserialize an SCM instance,
  this would create a polite “old data” record instead.
  (CopyOnWriteArrayList would also work, via RobustCollectionConverter.)
· The backing store is CopyOnWriteList, solving a hypothetical ConcurrentModificationException.
· Additions from onCheckout should be saved to disk immediately, rather than waiting for some other save trigger.
Originally-Committed-As: ad9b6caf0428b9c85601ef9d349ca2691b7055be
  • Loading branch information
jglick committed Jul 28, 2015
1 parent f95817b commit c1eb2e285c8264bf05dfc9b64ba1750c339818fe
Showing with 3 additions and 3 deletions.
  1. +3 −3 job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
@@ -51,6 +51,7 @@
import hudson.scm.SCM;
import hudson.scm.SCMRevisionState;
import hudson.util.NullStream;
import hudson.util.PersistedList;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -62,7 +63,6 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;
@@ -130,7 +130,7 @@
public WorkflowRun(WorkflowJob job) throws IOException {
super(job);
firstTime = true;
checkouts = new LinkedList<SCMCheckout>();
checkouts = new PersistedList<SCMCheckout>(this);
//System.err.printf("created %s @%h%n", this, this);
}

@@ -531,7 +531,7 @@ public boolean hasntStartedYet() {
if (listener != null) {
listener.error("JENKINS-26761: list of SCM checkouts in " + this + " was lost; polling will be broken");
}
checkouts = new LinkedList<SCMCheckout>();
checkouts = new PersistedList<SCMCheckout>(this);
// Could this.save(), but might pollute diagnosis, and (worse) might clobber real data if there is >1 WorkflowRun with the same ID.
}
return checkouts;

0 comments on commit c1eb2e2

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