Fix QueueHandler uncache

This commit is contained in:
Jesse Boyd 2019-11-11 20:14:57 +00:00
parent 751e6a5dd4
commit 2e6f46e451
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -267,6 +267,14 @@ public abstract class QueueHandler implements Trimable, Runnable {
queuePool.set(null); queuePool.set(null);
} }
private IQueueExtent pool() {
IQueueExtent queue = queuePool.get();
if (queue == null) {
queuePool.set(queue = queuePool.init());
}
return queue;
}
public abstract void startSet(boolean parallel); public abstract void startSet(boolean parallel);
public abstract void endSet(boolean parallel); public abstract void endSet(boolean parallel);
@ -276,7 +284,7 @@ public abstract class QueueHandler implements Trimable, Runnable {
} }
public IQueueExtent getQueue(World world, IBatchProcessor processor) { public IQueueExtent getQueue(World world, IBatchProcessor processor) {
final IQueueExtent queue = queuePool.get(); final IQueueExtent queue = pool();
IChunkCache<IChunkGet> cacheGet = getOrCreateWorldCache(world); IChunkCache<IChunkGet> cacheGet = getOrCreateWorldCache(world);
IChunkCache<IChunkSet> set = null; // TODO cache? IChunkCache<IChunkSet> set = null; // TODO cache?
queue.init(world, cacheGet, set); queue.init(world, cacheGet, set);