aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-21 05:55:33 (EST)
committerWinston Prakash2011-12-01 20:46:48 (EST)
commit6775598c5ee7411df5dd0ea6385c3d9a30c787de (patch)
tree0c3acbe8579530d7d775698cdf52aecf0cb47816
parentc969d5370cc5390c5373bb148b4832649db5fd69 (diff)
downloadorg.eclipse.hudson.core-6775598c5ee7411df5dd0ea6385c3d9a30c787de.zip
org.eclipse.hudson.core-6775598c5ee7411df5dd0ea6385c3d9a30c787de.tar.gz
org.eclipse.hudson.core-6775598c5ee7411df5dd0ea6385c3d9a30c787de.tar.bz2
Add configurable ThreadLocal value in order to skip saving config during submit operation
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/Job.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/hudson-core/src/main/java/hudson/model/Job.java b/hudson-core/src/main/java/hudson/model/Job.java
index c5a4efa..d49fd42 100644
--- a/hudson-core/src/main/java/hudson/model/Job.java
+++ b/hudson-core/src/main/java/hudson/model/Job.java
@@ -148,8 +148,10 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
@Override
public synchronized void save() throws IOException {
- super.save();
- holdOffBuildUntilSave = false;
+ if (allowSave.get()) {
+ super.save();
+ holdOffBuildUntilSave = false;
+ }
}
@Override
@@ -1022,7 +1024,9 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
}
+ allowSave.set(false);
submit(req, rsp);
+ allowSave.remove();
save();
@@ -1318,4 +1322,11 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
return run.getDisplayName() + " : " + run.getDurationString();
}
}
+
+ protected static final ThreadLocal<Boolean> allowSave = new ThreadLocal<Boolean>() {
+ @Override
+ protected Boolean initialValue() {
+ return true;
+ }
+ };
}