Additional top-level class in compilation unit: ByteBufferAllocator.
| Modifier and Type | Class and Description |
|---|---|
| private class | ByteBufferPool.
The allocator implementation. |
| Modifier and Type | Field and Description |
|---|---|
| private final int | bufferSize
The size of each byte buffer. |
| private final Queue | byteBuffers
The shared collection of byte buffers. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv ByteBufferAllocator | |
| pack-priv static ByteBufferPool |
| bufferSize | back to summary |
|---|---|
| private final int bufferSize The size of each byte buffer. | |
| byteBuffers | back to summary |
|---|---|
| private final Queue<ByteBuffer> byteBuffers The shared collection of byte buffers. | |
| ByteBufferPool | back to summary |
|---|---|
| private ByteBufferPool(int bufferSize) Creates a new pool. | |
| newAllocator | back to summary |
|---|---|
| pack-priv ByteBufferAllocator newAllocator(int maxBufferCount) Creates a new allocator associated with this pool.
The allocator will allow its client to allocate and release
buffers and will ensure that there are no more than
| |
| newInstance | back to summary |
|---|---|
| pack-priv static ByteBufferPool newInstance(int bufferSize) Creates a new pool. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Semaphore | semaphore
The semaphore used to limit the number of buffers allocated through this allocator. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | |
| public void | release(ByteBuffer byteBuffer)
Implements com. Releases a byte buffer. |
| semaphore | back to summary |
|---|---|
| private final Semaphore semaphore The semaphore used to limit the number of buffers allocated through this allocator. | |
| ByteBufferAllocatorImpl | back to summary |
|---|---|
| private ByteBufferAllocatorImpl(int maxBufferCount) Creates a new allocator. | |
| allocate | back to summary |
|---|---|
| public ByteBuffer allocate() throws InterruptedException Implements com. Doc from com. Allocates a byte buffer.
| |
| release | back to summary |
|---|---|
| public void release(ByteBuffer byteBuffer) Implements com. Doc from com. Releases a byte buffer.
| |