core/src/main/java/org/elasticsearch/cluster/service/ClusterService.java
public List<PendingClusterTask> pendingTasks() {
        PrioritizedEsThreadPoolExecutor.Pending[] pendings = updateTasksExecutor.getPending();
        List<PendingClusterTask> pendingClusterTasks = new ArrayList<>(pendings.length);
        for (PrioritizedEsThreadPoolExecutor.Pending pending : pendings) {
            final String source;
            final long timeInQueue;
            // we have to capture the task as it will be nulled after execution and we don't want to change while we check things here.
            final Object task = pending.task;
            if (task == null) {
                continue;
            } else if (task instanceof SourcePrioritizedRunnable) {
                SourcePrioritizedRunnable runnable = (SourcePrioritizedRunnable) task;
                source = runnable.source();
                timeInQueue = runnable.getAgeInMillis();
            } else {
                assert false : "expected SourcePrioritizedRunnable got " + task.getClass();
                source = "unknown [" + task.getClass() + "]";
                timeInQueue = 0;
            }

            pendingClusterTasks.add(
                    new PendingClusterTask(pending.insertionOrder, pending.priority, new Text(source), timeInQueue, pending.executing));
        }
        return pendingClusterTasks;
    }
/**
     * Returns the tasks that are pending.
     */
Returns the tasks that are pending.
Returns the tasks that are pending .
public List<PendingClusterTask> pendingTasks() {
        PrioritizedEsThreadPoolExecutor.Pending[] pendings = updateTasksExecutor.getPending();
        List<PendingClusterTask> pendingClusterTasks = new ArrayList<>(pendings.length);
        for (PrioritizedEsThreadPoolExecutor.Pending pending : pendings) {
            final String source;
            final long timeInQueue;
            final Object task = pending.task;
            if (task == null) {
                continue;
            } else if (task instanceof SourcePrioritizedRunnable) {
                SourcePrioritizedRunnable runnable = (SourcePrioritizedRunnable) task;
                source = runnable.source();
                timeInQueue = runnable.getAgeInMillis();
            } else {
                assert false : "expected SourcePrioritizedRunnable got " + task.getClass();
                source = "unknown [" + task.getClass() + "]";
                timeInQueue = 0;
            }
            pendingClusterTasks.add(
                    new PendingClusterTask(pending.insertionOrder, pending.priority, new Text(source), timeInQueue, pending.executing));
        }
        return pendingClusterTasks;
    }
public List < PendingClusterTask > pendingTasks ( ) { PrioritizedEsThreadPoolExecutor . Pending [ ] pendings = updateTasksExecutor . getPending ( ) ; List < PendingClusterTask > pendingClusterTasks = new ArrayList < > ( pendings . length ) ; for ( PrioritizedEsThreadPoolExecutor . Pending pending : pendings ) { final String source ; final long timeInQueue ; final Object task = pending . task ; if ( task == null ) { continue ; } else if ( task instanceof SourcePrioritizedRunnable ) { SourcePrioritizedRunnable runnable = ( SourcePrioritizedRunnable ) task ; source = runnable . source ( ) ; timeInQueue = runnable . getAgeInMillis ( ) ; } else { assert false : "expected SourcePrioritizedRunnable got " + task . getClass ( ) ; source = "unknown [" + task . getClass ( ) + "]" ; timeInQueue = 0 ; } pendingClusterTasks . add ( new PendingClusterTask ( pending . insertionOrder , pending . priority , new Text ( source ) , timeInQueue , pending . executing ) ) ; } return pendingClusterTasks ; }
Returns the tasks that are pending.
Returns the tasks that are pending .
// we have to capture the task as it will be nulled after execution and we don't want to change while we check things here.