Only forcefully submit a chunk if we hold the monitor.

- Properly ensures we don't try to submit chunks that already have a monitor (prevent the FAWE-freezing)
 - We can't detect if "no" threads hold the chunk's monitor, but equally that would also be kinda very bad practice.
Dieser Commit ist enthalten in:
dordsor21 2021-01-13 18:17:18 +00:00
Ursprung eaa9872294
Commit e94e3b7b05
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -250,8 +250,19 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
// - memory is low & queue size > num threads + 8 // - memory is low & queue size > num threads + 8
// - queue size > target size and primary queue has less than num threads submissions // - queue size > target size and primary queue has less than num threads submissions
if (enabledQueue && ((lowMem && size > Settings.IMP.QUEUE.PARALLEL_THREADS + 8) || (size > Settings.IMP.QUEUE.TARGET_SIZE && Fawe.get().getQueueHandler().isUnderutilized()))) { if (enabledQueue && ((lowMem && size > Settings.IMP.QUEUE.PARALLEL_THREADS + 8) || (size > Settings.IMP.QUEUE.TARGET_SIZE && Fawe.get().getQueueHandler().isUnderutilized()))) {
chunk = chunks.removeFirst(); int i = 0;
final Future future = submitUnchecked(chunk); boolean found = false;
while (i < chunks.size() && (chunk = chunks.get(i)) != null) {
if (Thread.holdsLock(chunk)) {
found = true;
break;
}
i++;
}
Future future = null;
if (found) {
future = submitUnchecked(chunk);
}
if (future != null && !future.isDone()) { if (future != null && !future.isDone()) {
final int targetSize; final int targetSize;
if (lowMem) { if (lowMem) {