mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-30 10:23:41 -04:00
Internal: Pending Task listing should account for task being nulled
This caused by #9671 and #9621 working together and cause an NPE
This commit is contained in:
parent
ce24e10783
commit
35f6496694
1 changed files with 7 additions and 3 deletions
|
@ -296,12 +296,16 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
||||||
for (PrioritizedEsThreadPoolExecutor.Pending pending : pendings) {
|
for (PrioritizedEsThreadPoolExecutor.Pending pending : pendings) {
|
||||||
final String source;
|
final String source;
|
||||||
final long timeInQueue;
|
final long timeInQueue;
|
||||||
if (pending.task instanceof TimedPrioritizedRunnable) {
|
// 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.
|
||||||
TimedPrioritizedRunnable runnable = (TimedPrioritizedRunnable) pending.task;
|
final Object task = pending.task;
|
||||||
|
if (task == null) {
|
||||||
|
continue;
|
||||||
|
} else if (task instanceof TimedPrioritizedRunnable) {
|
||||||
|
TimedPrioritizedRunnable runnable = (TimedPrioritizedRunnable) task;
|
||||||
source = runnable.source();
|
source = runnable.source();
|
||||||
timeInQueue = runnable.timeSinceCreatedInMillis();
|
timeInQueue = runnable.timeSinceCreatedInMillis();
|
||||||
} else {
|
} else {
|
||||||
assert false : "expected TimedPrioritizedRunnable got " + pending.task.getClass();
|
assert false : "expected TimedPrioritizedRunnable got " + task.getClass();
|
||||||
source = "unknown";
|
source = "unknown";
|
||||||
timeInQueue = 0;
|
timeInQueue = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue