prevent new builds during deletion.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9536 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2008-05-21 23:43:43 +00:00
1 parent 2e7ddd7db7
commit bbc9229cf9
2 files changed
+19

No files matched your search

@@ -166,6 +166,12 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
updateTransientActions();
}
protected void performDelete() throws IOException {
// prevent a new build while a delete operation is in progress
makeDisabled(true);
super.performDelete();
}
/**
* If this project is configured to be always built on this node,
* return that {@link Node}. Otherwise null.
+13
View File
@@ -143,6 +143,19 @@ public abstract class Job<JobT extends Job<JobT,RunT>, RunT extends Run<JobT,Run
this.nextBuildNumber = 1; // reset the next build number
}
protected void performDelete() throws IOException {
// if a build is in progress. Cancel it.
RunT lb = getLastBuild();
if(lb!=null) {
Executor e = lb.getExecutor();
if(e!=null) {
e.interrupt();
// should we block until the build is cancelled?
}
}
super.performDelete();
}
private TextFile getNextBuildNumberFile() {
return new TextFile(new File(this.getRootDir(),"nextBuildNumber"));
}