Beispiel #1
0
 public synchronized boolean cancel(Item item) {
   LOGGER.fine("Cancelling " + item.task.getFullDisplayName() + " item#" + item.id);
   // use bitwise-OR to make sure that all the branches get evaluated all the time
   boolean r =
       (item instanceof WaitingItem && waitingList.remove(item))
           | blockedProjects.remove(item)
           | buildables.remove(item);
   if (r) item.onCancelled();
   return r;
 }
Beispiel #2
0
 /**
  * Cancels the item in the queue. If the item is scheduled more than once, cancels the first
  * occurrence.
  *
  * @return true if the project was indeed in the queue and was removed. false if this was no-op.
  */
 public synchronized boolean cancel(Task p) {
   LOGGER.fine("Cancelling " + p.getFullDisplayName());
   for (Iterator<WaitingItem> itr = waitingList.iterator(); itr.hasNext(); ) {
     Item item = itr.next();
     if (item.task.equals(p)) {
       itr.remove();
       item.onCancelled();
       return true;
     }
   }
   // use bitwise-OR to make sure that both branches get evaluated all the time
   return blockedProjects.cancel(p) != null | buildables.cancel(p) != null;
 }
Beispiel #3
0
 /** Works like {@link #remove(Object)} but also marks the {@link Item} as cancelled. */
 public boolean cancel(Item t) {
   boolean r = remove(t);
   if (r) t.onCancelled();
   return r;
 }