@Override // Closeable public void close() { returnPacketBufToPool(); }
@Override // Closeable public void close() { returnPacketBufToPool(); }
@Override // Closeable public void close() { returnPacketBufToPool(); }
@Override protected void finalize() throws Throwable { try { // just in case it didn't get closed, we // may as well still try to return the buffer returnPacketBufToPool(); } finally { super.finalize(); } } }
@Override protected void finalize() throws Throwable { try { // just in case it didn't get closed, we // may as well still try to return the buffer returnPacketBufToPool(); } finally { super.finalize(); } } }
@Override protected void finalize() throws Throwable { try { // just in case it didn't get closed, we // may as well still try to return the buffer returnPacketBufToPool(); } finally { super.finalize(); } } }
private void reallocPacketBuf(int atLeastCapacity) { // Realloc the buffer if this packet is longer than the previous // one. if (curPacketBuf == null || curPacketBuf.capacity() < atLeastCapacity) { ByteBuffer newBuf; if (useDirectBuffers) { newBuf = bufferPool.getBuffer(atLeastCapacity); } else { newBuf = ByteBuffer.allocate(atLeastCapacity); } // If reallocing an existing buffer, copy the old packet length // prefixes over if (curPacketBuf != null) { curPacketBuf.flip(); newBuf.put(curPacketBuf); } returnPacketBufToPool(); curPacketBuf = newBuf; } }
private void reallocPacketBuf(int atLeastCapacity) { // Realloc the buffer if this packet is longer than the previous // one. if (curPacketBuf == null || curPacketBuf.capacity() < atLeastCapacity) { ByteBuffer newBuf; if (useDirectBuffers) { newBuf = bufferPool.getBuffer(atLeastCapacity); } else { newBuf = ByteBuffer.allocate(atLeastCapacity); } // If reallocing an existing buffer, copy the old packet length // prefixes over if (curPacketBuf != null) { curPacketBuf.flip(); newBuf.put(curPacketBuf); } returnPacketBufToPool(); curPacketBuf = newBuf; } }
private void reallocPacketBuf(int atLeastCapacity) { // Realloc the buffer if this packet is longer than the previous // one. if (curPacketBuf == null || curPacketBuf.capacity() < atLeastCapacity) { ByteBuffer newBuf; if (useDirectBuffers) { newBuf = bufferPool.getBuffer(atLeastCapacity); } else { newBuf = ByteBuffer.allocate(atLeastCapacity); } // If reallocing an existing buffer, copy the old packet length // prefixes over if (curPacketBuf != null) { curPacketBuf.flip(); newBuf.put(curPacketBuf); } returnPacketBufToPool(); curPacketBuf = newBuf; } }