Tiny optimization
This commit is contained in:
parent
f4d7f573a1
commit
558c02b0df
@ -44,6 +44,7 @@ final class ReadBufferPool {
|
||||
}
|
||||
|
||||
final ByteBuffer acquire(int size) {
|
||||
final SoftReference<ByteBuffer>[] pool = this.pool;
|
||||
for (int i = 0; i < POOL_SIZE; i ++) {
|
||||
SoftReference<ByteBuffer> ref = pool[i];
|
||||
if (ref == null) {
|
||||
@ -73,6 +74,7 @@ final class ReadBufferPool {
|
||||
}
|
||||
|
||||
final void release(ByteBuffer buffer) {
|
||||
final SoftReference<ByteBuffer>[] pool = this.pool;
|
||||
for (int i = 0; i < POOL_SIZE; i ++) {
|
||||
SoftReference<ByteBuffer> ref = pool[i];
|
||||
if (ref == null || ref.get() == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user