mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Actually implement ChunkHolder/ChunkSet pools (#1840)
This commit is contained in:
parent
800988aae7
commit
8094b68967
@ -67,8 +67,14 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized void recycle() {
|
public synchronized void recycle() {
|
||||||
delegate = NULL;
|
delegate = NULL;
|
||||||
|
if (chunkSet != null) {
|
||||||
|
chunkSet.recycle();
|
||||||
chunkSet = null;
|
chunkSet = null;
|
||||||
}
|
}
|
||||||
|
chunkExisting = null;
|
||||||
|
extent = null;
|
||||||
|
POOL.offer(this);
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized IBlockDelegate getDelegate() {
|
public synchronized IBlockDelegate getDelegate() {
|
||||||
return delegate;
|
return delegate;
|
||||||
@ -1039,7 +1045,9 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
chunkSet.setBitMask(bitMask);
|
chunkSet.setBitMask(bitMask);
|
||||||
try {
|
try {
|
||||||
return this.call(chunkSet, () -> {
|
return this.call(chunkSet, () -> {
|
||||||
recycle();
|
this.delegate = NULL;
|
||||||
|
chunkSet.recycle();
|
||||||
|
chunkSet = null;
|
||||||
calledLock.unlock(stamp);
|
calledLock.unlock(stamp);
|
||||||
});
|
});
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
Loading…
Reference in New Issue
Block a user