ObjectPool关闭public构造函数

This commit is contained in:
Redkale
2021-01-19 16:45:00 +08:00
parent 80c07a5c5b
commit fa7db42f50
13 changed files with 87 additions and 44 deletions

View File

@@ -149,7 +149,7 @@ public class ABMainService implements Service {
}
public static ObjectPool<ByteBuffer> newBufferPool() {
return new ObjectPool<>(new AtomicLong(), new AtomicLong(), 16,
return ObjectPool.createSafePool(new AtomicLong(), new AtomicLong(), 16,
(Object... params) -> ByteBuffer.allocateDirect(8192), null, (e) -> {
if (e == null || e.isReadOnly() || e.capacity() != 8192) return false;
e.clear();

View File

@@ -66,7 +66,7 @@ public class SncpTest {
}
public static ObjectPool<ByteBuffer> newBufferPool() {
return new ObjectPool<>(new AtomicLong(), new AtomicLong(), 16,
return ObjectPool.createSafePool(new AtomicLong(), new AtomicLong(), 16,
(Object... params) -> ByteBuffer.allocateDirect(8192), null, (e) -> {
if (e == null || e.isReadOnly() || e.capacity() != 8192) return false;
e.clear();