Tiny optimization

This commit is contained in:
Trustin Lee 2010-02-19 00:57:23 +00:00
parent f4d7f573a1
commit 558c02b0df

View File

@ -44,6 +44,7 @@ final class ReadBufferPool {
} }
final ByteBuffer acquire(int size) { final ByteBuffer acquire(int size) {
final SoftReference<ByteBuffer>[] pool = this.pool;
for (int i = 0; i < POOL_SIZE; i ++) { for (int i = 0; i < POOL_SIZE; i ++) {
SoftReference<ByteBuffer> ref = pool[i]; SoftReference<ByteBuffer> ref = pool[i];
if (ref == null) { if (ref == null) {
@ -73,6 +74,7 @@ final class ReadBufferPool {
} }
final void release(ByteBuffer buffer) { final void release(ByteBuffer buffer) {
final SoftReference<ByteBuffer>[] pool = this.pool;
for (int i = 0; i < POOL_SIZE; i ++) { for (int i = 0; i < POOL_SIZE; i ++) {
SoftReference<ByteBuffer> ref = pool[i]; SoftReference<ByteBuffer> ref = pool[i];
if (ref == null || ref.get() == null) { if (ref == null || ref.get() == null) {