mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-19 10:25:00 +00:00
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.
This commit is contained in:
parent
eaa9872294
commit
e94e3b7b05
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user