Пример #1
0
 /**
  * Cancel the request. Any IO in progress will be interrupted.
  *
  * @param id
  * @param explanation A reason to log
  * @throws NoSuchElementException
  */
 public synchronized void cancel(int id, @Nullable String explanation)
     throws NoSuchElementException {
   PrioritizedRequest request = _jobs.get(id);
   if (request == null) {
     throw new NoSuchElementException("Job " + id + " not found");
   }
   request.kill(explanation);
   if (_queue.remove(request)) {
     postprocessWithoutJobSlot(request);
   }
 }