mirror of https://github.com/apache/nifi.git
NIFI-9790: This closes #5860. Fixed race condition in which SwappablePriorityQueue could attempt to access the 0th element of an empty collection
Signed-off-by: Joe Witt <joewitt@apache.org>
This commit is contained in:
parent
237e481c4a
commit
7ff70706ee
|
@ -460,6 +460,8 @@ public class SwappablePriorityQueue {
|
|||
// Because we cannot obtain the write lock while already holding the read lock, we set a flag so that we
|
||||
// can migrate swap to active queue only after we've released the read lock.
|
||||
mustMigrateSwapToActive = true;
|
||||
} else if (swapQueue.isEmpty()) {
|
||||
return FlowFileAvailability.ACTIVE_QUEUE_EMPTY;
|
||||
} else {
|
||||
top = swapQueue.get(0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue