Fix a lot of FAWE-freezing properly

- Add a "loadPrivately" method to be used when GetChunks are called to avoid synchronocity issues with super classes being used on different threads
 - Synchronise the call method so we're not attempting to call whilst also loading/updating
This commit is contained in:
dordsor21
2021-01-13 19:02:51 +00:00
parent e94e3b7b05
commit be9866ddb3
6 changed files with 50 additions and 31 deletions

View File

@ -9,8 +9,6 @@ import org.jetbrains.annotations.Range;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.locks.ReentrantLock;
public abstract class CharBlocks implements IBlocks {
public static final Logger logger = LoggerFactory.getLogger(CharBlocks.class);

View File

@ -250,19 +250,8 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
// - memory is low & queue size > num threads + 8
// - 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()))) {
int i = 0;
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);
}
chunk = chunks.removeFirst();
final Future future = submitUnchecked(chunk);
if (future != null && !future.isDone()) {
final int targetSize;
if (lowMem) {