public boolean cancel(Item item) { LOGGER.log(Level.FINE, "Cancelling {0} item#{1}", new Object[] {item.task, item.id}); lock.lock(); try { try { return item.cancel(this); } finally { updateSnapshot(); } } finally { lock.unlock(); } }
/** * 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 boolean cancel(Task p) { lock.lock(); try { try { LOGGER.log(Level.FINE, "Cancelling {0}", p); for (WaitingItem item : waitingList) { if (item.task.equals(p)) { return item.cancel(this); } } // use bitwise-OR to make sure that both branches get evaluated all the time return blockedProjects.cancel(p) != null | buildables.cancel(p) != null; } finally { updateSnapshot(); } } finally { lock.unlock(); } }
/** * Called when the executor actually starts executing the assigned work unit. * * This moves the task from the pending state to the "left the queue" state. */ /*package*/ void onStartExecuting(Executor exec) throws InterruptedException { lock.lock(); try { try { final WorkUnit wu = exec.getCurrentWorkUnit(); pendings.remove(wu.context.item); LeftItem li = new LeftItem(wu.context); li.enter(this); } finally { updateSnapshot(); } } finally { lock.unlock(); } }
} finally { updateSnapshot(); } } finally { lock.unlock();
/** * Wipes out all the items currently in the queue, as if all of them are cancelled at once. */ public void clear() { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); lock.lock(); try { try { for (WaitingItem i : new ArrayList<WaitingItem>( waitingList)) // copy the list as we'll modify it in the loop i.cancel(this); blockedProjects.cancelAll(); pendings.cancelAll(); buildables.cancelAll(); } finally { updateSnapshot(); } } finally { lock.unlock(); } scheduleMaintenance(); }
} finally { updateSnapshot(); } } finally { lock.unlock();
} finally { updateSnapshot(); } } finally { lock.unlock();
updateSnapshot(); updateSnapshot(); updateSnapshot(); continue; LOGGER.log(Level.FINEST, "Executing flyweight task {0}", taskDisplayName); r.run(); updateSnapshot(); updateSnapshot(); } finally { updateSnapshot(); } } finally { lock.unlock();
public boolean cancel(Item item) { LOGGER.log(Level.FINE, "Cancelling {0} item#{1}", new Object[] {item.task, item.id}); lock.lock(); try { try { return item.cancel(this); } finally { updateSnapshot(); } } finally { lock.unlock(); } }
/** * 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 boolean cancel(Task p) { lock.lock(); try { try { LOGGER.log(Level.FINE, "Cancelling {0}", p); for (WaitingItem item : waitingList) { if (item.task.equals(p)) { return item.cancel(this); } } // use bitwise-OR to make sure that both branches get evaluated all the time return blockedProjects.cancel(p) != null | buildables.cancel(p) != null; } finally { updateSnapshot(); } } finally { lock.unlock(); } }
/** * Called when the executor actually starts executing the assigned work unit. * * This moves the task from the pending state to the "left the queue" state. */ /*package*/ void onStartExecuting(Executor exec) throws InterruptedException { lock.lock(); try { try { final WorkUnit wu = exec.getCurrentWorkUnit(); pendings.remove(wu.context.item); LeftItem li = new LeftItem(wu.context); li.enter(this); } finally { updateSnapshot(); } } finally { lock.unlock(); } }
} finally { updateSnapshot(); } } finally { lock.unlock();
/** * Wipes out all the items currently in the queue, as if all of them are cancelled at once. */ public void clear() { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); lock.lock(); try { try { for (WaitingItem i : new ArrayList<WaitingItem>( waitingList)) // copy the list as we'll modify it in the loop i.cancel(this); blockedProjects.cancelAll(); pendings.cancelAll(); buildables.cancelAll(); } finally { updateSnapshot(); } } finally { lock.unlock(); } scheduleMaintenance(); }
} finally { updateSnapshot(); } } finally { lock.unlock();
} finally { updateSnapshot(); } } finally { lock.unlock();
updateSnapshot(); updateSnapshot(); updateSnapshot(); continue; LOGGER.log(Level.FINEST, "Executing flyweight task {0}", taskDisplayName); r.run(); updateSnapshot(); updateSnapshot(); } finally { updateSnapshot(); } } finally { lock.unlock();