Actually implement ChunkHolder/ChunkSet pools (#1840)

This commit is contained in:
Jordan 2022-06-24 10:13:58 +01:00 committed by GitHub
parent 800988aae7
commit 8094b68967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,8 +67,14 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
@Override
public synchronized void recycle() {
delegate = NULL;
if (chunkSet != null) {
chunkSet.recycle();
chunkSet = null;
}
chunkExisting = null;
extent = null;
POOL.offer(this);
}
public synchronized IBlockDelegate getDelegate() {
return delegate;
@ -1039,7 +1045,9 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
chunkSet.setBitMask(bitMask);
try {
return this.call(chunkSet, () -> {
recycle();
this.delegate = NULL;
chunkSet.recycle();
chunkSet = null;
calledLock.unlock(stamp);
});
} catch (Throwable t) {