Prevent potential ConcurrentModificationException in the build queue

This commit is contained in:
CalDescent 2022-02-09 20:20:30 +00:00
parent 06b5b8f793
commit 2637311ef5

View File

@ -36,11 +36,15 @@ public class ArbitraryDataBuilderThread implements Runnable {
continue;
}
Map.Entry<String, ArbitraryDataBuildQueueItem> next = null;
// Find resources that are queued for building
Map.Entry<String, ArbitraryDataBuildQueueItem> next = buildManager.arbitraryDataBuildQueue
synchronized (buildManager.arbitraryDataBuildQueue) {
next = buildManager.arbitraryDataBuildQueue
.entrySet().stream()
.filter(e -> e.getValue().isQueued())
.findFirst().orElse(null);
}
if (next == null) {
continue;