Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Varghese2014-09-02 19:45:04 -0400
committerRoy Varghese2014-09-02 19:45:04 -0400
commit4fd536c39903050ae506c578765ac5cb8fad209f (patch)
treed0a6170bf798d15d2e5c812656ed56871c19cb84
parentb92d504ac0207ea3b37cbb3d7cd62208893bfa38 (diff)
downloadorg.eclipse.hudson.core-4fd536c39903050ae506c578765ac5cb8fad209f.tar.gz
org.eclipse.hudson.core-4fd536c39903050ae506c578765ac5cb8fad209f.tar.xz
org.eclipse.hudson.core-4fd536c39903050ae506c578765ac5cb8fad209f.zip
Do not attempt to load build chain if processing placeholder build.
Also, abbreviate build load error messages in log, do not print stack Signed-off-by: Roy Varghese <rovarghe@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/Run.java31
-rw-r--r--hudson-core/src/main/java/hudson/model/RunMap.java2
2 files changed, 28 insertions, 5 deletions
diff --git a/hudson-core/src/main/java/hudson/model/Run.java b/hudson-core/src/main/java/hudson/model/Run.java
index fcb1af44..329a0943 100644
--- a/hudson-core/src/main/java/hudson/model/Run.java
+++ b/hudson-core/src/main/java/hudson/model/Run.java
@@ -225,6 +225,17 @@ public abstract class Run<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
return new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
}
};
+
+ /**
+ * State when a Run is being created from cached values.
+ */
+ private static final ThreadLocal<Boolean> IS_LOADING_CACHED_VALUES =
+ new ThreadLocal<Boolean>() {
+ @Override
+ protected Boolean initialValue() {
+ return false;
+ }
+ };
/**
* Creates a new {@link Run}.
@@ -264,8 +275,8 @@ public abstract class Run<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
try {
getDataFile().unmarshal(this); // load the rest of the data
}
- catch (IOException ex) {
- LOGGER.log(Level.SEVERE, "Unable to load Run object.", ex);
+ catch (Exception ex) {
+ LOGGER.log(Level.SEVERE, "Unable to load Run object: " + ex.getMessage());
dataFileLoadException = ex;
RunMap.LazyRunValue.Key key = RunMap.LazyRunValue.getCurrentKey();
if ( key != null ) {
@@ -373,11 +384,23 @@ public abstract class Run<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
this.displayName = String.format("%s [In Error]",key.referenced.displayName);
this.duration = key.referenced.duration;
- this.nextBuild = (RunT)key.referenced.getNextBuild();
- this.previousBuild = (RunT)key.referenced.getPreviousBuild();
this.result = key.referenced.result;
this.state = key.referenced.state;
this.timestamp = key.referenced.timeInMillis;
+
+ // Try to load other builds only if not already processing another
+ // cached build
+ if (! IS_LOADING_CACHED_VALUES.get()) {
+ try {
+ IS_LOADING_CACHED_VALUES.set(true);
+
+ this.nextBuild = (RunT)key.referenced.getNextBuild();
+ this.previousBuild = (RunT)key.referenced.getPreviousBuild();
+ }
+ finally {
+ IS_LOADING_CACHED_VALUES.set(false);
+ }
+ }
}
/**
diff --git a/hudson-core/src/main/java/hudson/model/RunMap.java b/hudson-core/src/main/java/hudson/model/RunMap.java
index eaa66058..52c17b38 100644
--- a/hudson-core/src/main/java/hudson/model/RunMap.java
+++ b/hudson-core/src/main/java/hudson/model/RunMap.java
@@ -800,7 +800,7 @@ public final class RunMap<J extends Job<J, R>, R extends Run<J, R>>
try {
return cache.get(key);
} catch (ExecutionException ex) {
- LOGGER.log(Level.SEVERE,"Unable to load build", ex);
+ LOGGER.log(Level.SEVERE,"Unable to load build: " + ex.getMessage());
return null;
}

Back to the top