diff --git a/core/src/main/java/hudson/model/Queue.java b/core/src/main/java/hudson/model/Queue.java index 77cff428cb..e59fcc2309 100644 --- a/core/src/main/java/hudson/model/Queue.java +++ b/core/src/main/java/hudson/model/Queue.java @@ -31,6 +31,20 @@ import java.util.logging.Logger; * task that are placed in the queue. While in the queue, it's wrapped into {@link Item} * so that we can keep track of additional data used for deciding what to exeucte when. * + *
+ * Items in queue goes through several stages, as depicted below: + *
+ * (enter) --> waitingList --+--> blockedProjects + * | ^ + * | | + * | v + * +--> buildables ---> (executed) + *+ * + *
+ * In addition, at any stage, an item can be removed from the queue (for example, when the user
+ * cancels a job in the queue.) See the corresponding field for their exact meanings.
+ *
* @author Kohsuke Kawaguchi
*/
public class Queue extends ResourceController {
@@ -41,7 +55,7 @@ public class Queue extends ResourceController {
* This consists of {@link Item}s that cannot be run yet
* because its time has not yet come.
*/
- private final Set
- * Move projects between {@link #queue}, {@link #blockedProjects}, and {@link #buildables}
+ * Move projects between {@link #waitingList}, {@link #blockedProjects}, and {@link #buildables}
* appropriately.
*/
private synchronized void maintain() {
@@ -533,7 +547,7 @@ public class Queue extends ResourceController {
}
}
- while (!queue.isEmpty()) {
+ while (!waitingList.isEmpty()) {
Item top = peek();
if (!top.timestamp.before(new GregorianCalendar()))
@@ -542,14 +556,14 @@ public class Queue extends ResourceController {
Task p = top.task;
if (!isBuildBlocked(p)) {
// ready to be executed immediately
- queue.remove(top);
+ waitingList.remove(top);
LOGGER.fine(p.getName() + " ready to build");
buildables.add(p);
enterBuildables.put(p, System.currentTimeMillis());
} else {
// this can't be built now because another build is in progress
// set this project aside.
- queue.remove(top);
+ waitingList.remove(top);
LOGGER.fine(p.getName() + " is blocked");
blockedProjects.add(p);
}