Remove a job from the given queue.

@param curQueue the queue to remove a job from
@return a JSON string of a job or null if there was nothing to de-queue
548998
protected String pop(final String curQueue) {
        final String key = key(QUEUE, curQueue);
        final String now = Long.toString(System.currentTimeMillis());
        final String inflightKey = key(INFLIGHT, this.name, curQueue);
        return PoolUtils.doWorkInPoolNicely(this.jedisPool, new PoolWork<Jedis, String>() {
            /**
             * {@inheritDoc}
             */
            @Override
            public String doWork(final Jedis jedis) {
                switch (nextQueueStrategy) {
                    case DRAIN_WHILE_MESSAGES_EXISTS:
                        return (String) jedis.evalsha(popScriptHash.get(), 3, key, inflightKey,
                                JesqueUtils.createRecurringHashKey(key), now);
                    case RESET_TO_HIGHEST_PRIORITY:
                        return (String) jedis.evalsha(multiPriorityQueuesScriptHash.get(), 3, curQueue, inflightKey, namespace, now);
                    default:
                        throw new RuntimeException("Unimplemented 'nextQueueStrategy'");
                }
            }
        });
    }
88367
public void removeJobType(final Class<?> jobType) {
        if (jobType == null) {
            throw new IllegalArgumentException("jobType must not be null");
        }
        this.jobTypes.values().remove(jobType);
    }
938070
protected void failure(final Throwable thrwbl, final Job job, final String curQueue) {
        // The job may have taken a long time; make an effort to ensure the connection is OK
        JedisUtils.ensureJedisConnection(this.jedis);
        try {
            this.jedis.incr(key(STAT, FAILED));
            this.jedis.incr(key(STAT, FAILED, this.name));
            final FailQueueStrategy strategy = this.failQueueStrategyRef.get();
            final String failQueueKey = strategy.getFailQueueKey(thrwbl, job, curQueue);
            if (failQueueKey != null) {
                final int failQueueMaxItems = strategy.getFailQueueMaxItems(curQueue);
                if (failQueueMaxItems > 0) {
                    Long currentItems = this.jedis.llen(failQueueKey);
                    if (currentItems >= failQueueMaxItems) {
                        Transaction tx = this.jedis.multi();
                        tx.ltrim(failQueueKey, 1, -1);
                        tx.rpush(failQueueKey, failMsg(thrwbl, curQueue, job));
                        tx.exec();
                    } else {
                        this.jedis.rpush(failQueueKey, failMsg(thrwbl, curQueue, job));
                    }
                } else {
                    this.jedis.rpush(failQueueKey, failMsg(thrwbl, curQueue, job));
                }
            }
        } catch (JedisException je) {
            LOG.warn("Error updating failure stats for throwable=" + thrwbl + " job=" + job, je);
        } catch (IOException ioe) {
            LOG.warn("Error serializing failure payload for throwable=" + thrwbl + " job=" + job, ioe);
        }
        this.listenerDelegate.fireEvent(JOB_FAILURE, this, curQueue, job, null, null, thrwbl);
    }
1270846
public QueueElement removeTail() {

		if (head == null) {
			return null;
		}

		QueueElement result = tail;
		if (result.previous == null) {
			head = null;
			tail = null;
		} else {
			tail = result.previous;
			tail.next = null;
		}
		result.previous = null;
		result.next = null;
		result.queue = null;

		numElements--;
		return result;

	}
533164
@Override
    public void requeue(Task task) {
        int attempts = task.getAttempts();
        task.incrementAttempts();
        try {
            deleteTask(task);
        } catch (TaskNotFoundException e) {
            log.error("unable to delete " + task + " ignoring - requeuing anyway");
        }

        put(task);
        log.warn("requeued {} after {} failed attempts.", task, attempts);

    }
90054
private void purgeDeadJobInstances(DbConn cnx, Node node)
    {
        for (JobInstance ji : JobInstance.select(cnx, "ji_select_by_node", node.getId()))
        {
            try
            {
                cnx.runSelectSingle("history_select_state_by_id", String.class, ji.getId());
            }
            catch (NoResultException e)
            {
                History.create(cnx, ji, State.CRASHED, Calendar.getInstance());
                Message.create(cnx,
                        "Job was supposed to be running at server startup - usually means it was killed along a server by an admin or a crash",
                        ji.getId());
            }

            cnx.runUpdate("ji_delete_by_id", ji.getId());
        }
        cnx.commit();
    }
1311720
public static void emptyAndRemoveQueue( String strQueueName )
  {
    TaskQueue taskQueue = QUEUE_MAP.get( strQueueName );
    if( taskQueue != null )
    {
      taskQueue.emptyQueue();
      synchronized( taskQueue._queue )
      {
        taskQueue._shutdown = true;
        taskQueue._queue.notifyAll();
      }
      QUEUE_MAP.remove( strQueueName );
    }
  }
662155
public void remove(String fqn) {
        awaitRunning();
        try {
            channel.send(new Message(null, new Request(Request.REMOVE, fqn)));
        } catch (Exception ex) {
            LOG.error("failure bcasting REMOVE request", ex);
        }
    }
1002630
@RequirePOST
    public final void doCancelQueue( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
        asJob().checkPermission(Item.CANCEL);
        Jenkins.getInstance().getQueue().cancel(asJob());
        rsp.forwardToPreviousPage(req);
    }
1197612
boolean removeEq(Object o) {
        for (int i = 0; i < size; i++) {
            if (o == queue[i]) {
                removeAt(i);
                return true;
            }
        }
        return false;
    }
599852
@Override
    public java.util.concurrent.Future<DeleteQueueResult> deleteQueueAsync(String queueUrl,
            com.amazonaws.handlers.AsyncHandler<DeleteQueueRequest, DeleteQueueResult> asyncHandler) {

        return deleteQueueAsync(new DeleteQueueRequest().withQueueUrl(queueUrl), asyncHandler);
    }
110236
public final Futures delete( Key<Job> job_key, Futures fs ) {
    if( _key != null ) {
      Log.debug("lock-then-delete "+_key+" by job "+job_key);
      new PriorWriteLock(job_key).invoke(_key);
    }
    return remove(fs);
  }
1334534
@Override
    public void cancelJob(int idJob)
    {
        jqmlogger.trace("Job instance number " + idJob + " will be cancelled");
        DbConn cnx = null;
        try
        {
            cnx = getDbSession();
            QueryResult res = cnx.runUpdate("jj_update_cancel_by_id", idJob);
            if (res.nbUpdated != 1)
            {
                throw new JqmClientException("the job is already running, has already finished or never existed to begin with");
            }
        }
        catch (RuntimeException e)
        {
            closeQuietly(cnx);
            throw e;
        }

        try
        {
            History.create(cnx, idJob, State.CANCELLED, null);
            JobInstance.delete_id(cnx, idJob);
            cnx.commit();
        }
        catch (Exception e)
        {
            throw new JqmClientException("could not historise the job instance after it was cancelled", e);
        }
        finally
        {
            closeQuietly(cnx);
        }
    }
1016273
@Override
	public boolean remove(Object o) {
		boolean b = queue.remove(o);
		if (b){
			signalSizeReduced();
		}
		return b;
	}
565400
private boolean removeFromSplitterQueue(Block<S, L> block) {
        ElementReference ref = block.getSplitterQueueReference();
        if (ref == null) {
            return false;
        }

        splitters.remove(ref);
        block.setSplitterQueueReference(null);

        return true;
    }
1296651
function JobQueue(para) {
	this.queue = [];
	this.curr = 0;
	this.all_passed = true;
	this.timeout = ((typeof para === 'object' && typeof para.timeout === 'number') ? para.timeout : 0);
}
387316
public static void removeJob(String jobName) throws SundialSchedulerException {

    try {
      getScheduler().deleteJob(jobName);
    } catch (SchedulerException e) {
      throw new SundialSchedulerException("ERROR REMOVING JOB!!!", e);
    }
  }