Package com.tangosol.io
Class ByteArrayWriteBuffer.Allocator
java.lang.Object
com.tangosol.io.ByteArrayWriteBuffer.Allocator
- All Implemented Interfaces:
MultiBufferWriteBuffer.WriteBufferPool
- Enclosing class:
ByteArrayWriteBuffer
public static class ByteArrayWriteBuffer.Allocator
extends Object
implements MultiBufferWriteBuffer.WriteBufferPool
Allocator is a WriteBufferPool implementation which allocates a new
ByteArrayWriteBuffer on each request to the pool, and does not retain
the returned buffer. Essentially it is dummy pool which acts as an
allocator.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
The capacity of the ByteArrayWriteBuffer instances to allocate. -
Constructor Summary
ConstructorDescriptionAllocator
(int cb) Construct an Allocator for ByteArrayWriteBuffers of a given size. -
Method Summary
Modifier and TypeMethodDescriptionallocate
(int cbPreviousTotal) Allocate a new ByteArrayWriteBuffer.int
Determine the largest amount of aggregate WriteBuffer capacity that this factory can provide.void
release
(WriteBuffer buffer) Release the supplied buffer into the pool.
-
Field Details
-
m_cb
protected int m_cbThe capacity of the ByteArrayWriteBuffer instances to allocate.
-
-
Constructor Details
-
Allocator
public Allocator(int cb) Construct an Allocator for ByteArrayWriteBuffers of a given size.- Parameters:
cb
- the capacity of the ByteArrayWriteBuffer to be allocated
-
-
Method Details
-
getMaximumCapacity
public int getMaximumCapacity()Determine the largest amount of aggregate WriteBuffer capacity that this factory can provide.- Specified by:
getMaximumCapacity
in interfaceMultiBufferWriteBuffer.WriteBufferPool
- Returns:
- the number of bytes that can be stored in the WriteBuffer objects that may be returned from this factory
-
allocate
Allocate a new ByteArrayWriteBuffer.- Specified by:
allocate
in interfaceMultiBufferWriteBuffer.WriteBufferPool
- Parameters:
cbPreviousTotal
- unused- Returns:
- a new ByteArrayWriteBuffer with this Allocator's
capacity
-
release
Release the supplied buffer into the pool.This method is a no op.
- Specified by:
release
in interfaceMultiBufferWriteBuffer.WriteBufferPool
- Parameters:
buffer
- unused
-