提交 84bca061 编写于 作者: P pgweiss

Another fix for non-concurrent builds being built concurrently.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@24637 71c3de6d-444a-0410-be80-ed276b4c234a
上级 53c8bb4b
...@@ -834,7 +834,14 @@ public class Queue extends ResourceController implements Saveable { ...@@ -834,7 +834,14 @@ public class Queue extends ResourceController implements Saveable {
return t.isBuildBlocked() || !canRun(t.getResourceList()); return t.isBuildBlocked() || !canRun(t.getResourceList());
} }
/**
* Make sure we don't queue two tasks of the same project to be built
* unless that project allows concurrent builds.
*/
private boolean allowNewBuildableTask (Task t) {
return t.isConcurrentBuild() || !buildables.containsKey(t);
}
/** /**
* Queue maintenance. * Queue maintenance.
* <p> * <p>
...@@ -848,15 +855,7 @@ public class Queue extends ResourceController implements Saveable { ...@@ -848,15 +855,7 @@ public class Queue extends ResourceController implements Saveable {
Iterator<BlockedItem> itr = blockedProjects.values().iterator(); Iterator<BlockedItem> itr = blockedProjects.values().iterator();
while (itr.hasNext()) { while (itr.hasNext()) {
BlockedItem p = itr.next(); BlockedItem p = itr.next();
if (!isBuildBlocked(p.task)) { if (!isBuildBlocked(p.task) && allowNewBuildableTask(p.task)) {
// Make sure that we don't make more than one item buildable unless the
// project can handle concurrent builds
if (p.task instanceof AbstractProject<?,?>) {
AbstractProject<?,?> proj = (AbstractProject<?,?>) p.task;
if (!proj.isConcurrentBuild() && buildables.containsKey(p.task)) {
continue;
}
}
// ready to be executed // ready to be executed
LOGGER.fine(p.task.getFullDisplayName() + " no longer blocked"); LOGGER.fine(p.task.getFullDisplayName() + " no longer blocked");
itr.remove(); itr.remove();
...@@ -872,7 +871,7 @@ public class Queue extends ResourceController implements Saveable { ...@@ -872,7 +871,7 @@ public class Queue extends ResourceController implements Saveable {
waitingList.remove(top); waitingList.remove(top);
Task p = top.task; Task p = top.task;
if (!isBuildBlocked(p)) { if (!isBuildBlocked(p) && allowNewBuildableTask(p)) {
// ready to be executed immediately // ready to be executed immediately
LOGGER.fine(p.getFullDisplayName() + " ready to build"); LOGGER.fine(p.getFullDisplayName() + " ready to build");
makeBuildable(new BuildableItem(top)); makeBuildable(new BuildableItem(top));
...@@ -1045,6 +1044,11 @@ public class Queue extends ResourceController implements Saveable { ...@@ -1045,6 +1044,11 @@ public class Queue extends ResourceController implements Saveable {
* URL that ends with '/'. * URL that ends with '/'.
*/ */
String getUrl(); String getUrl();
/**
* True if the task allows concurrent builds
*/
boolean isConcurrentBuild();
} }
public interface Executable extends Runnable { public interface Executable extends Runnable {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册