aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-21 05:55:33 (EST)
committerWinston Prakash2011-12-01 20:46:48 (EST)
commit2ccdbacaddd4a0cce0e0c7a996235dcd95cdef59 (patch)
tree0275e1fd2aa89c790dbdcc43802535ffa4b669e6
parentdf857725069de0b517e54b7dc0b5f0cdb72706d0 (diff)
downloadorg.eclipse.hudson.core-2ccdbacaddd4a0cce0e0c7a996235dcd95cdef59.zip
org.eclipse.hudson.core-2ccdbacaddd4a0cce0e0c7a996235dcd95cdef59.tar.gz
org.eclipse.hudson.core-2ccdbacaddd4a0cce0e0c7a996235dcd95cdef59.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;
+ }
+ };
}