Oracle® Coherence Java API Reference
v3.5

E14977-01

com.tangosol.io
Interface MultiBufferWriteBuffer.WriteBufferPool

All Known Implementing Classes:
ByteArrayWriteBuffer.Allocator
Enclosing class:
MultiBufferWriteBuffer

public static interface MultiBufferWriteBuffer.WriteBufferPool

A WriteBufferPool is used to dynamically allocate WriteBuffer objects as the MultiBufferWriteBuffer requires them. It is expected that implementations may use pooling, or may create WriteBuffer objects as necessary.


Method Summary
 WriteBuffer allocate(int cbPreviousTotal)
          Allocate a WriteBuffer for use by the MultiBufferWriteBuffer.
 int getMaximumCapacity()
          Determine the largest amount of aggregate WriteBuffer capacity that this factory can provide.
 void release(WriteBuffer buffer)
          Returns a WriteBuffer to the pool.
 

Method Detail

getMaximumCapacity

int getMaximumCapacity()
Determine the largest amount of aggregate WriteBuffer capacity that this factory can provide.

Returns:
the number of bytes that can be stored in the WriteBuffer objects that may be returned from this factory

allocate

WriteBuffer allocate(int cbPreviousTotal)
Allocate a WriteBuffer for use by the MultiBufferWriteBuffer. The MultiBufferWriteBuffer calls this factory method when it exhausts the storage capacity of previously allocated WriteBuffer objects.

Note that the returned WriteBuffer is expected to be empty, and its capacity is expected to be identical to its maximum capacity, i.e. it is not expected to resize itself, since the purpose of the MultiBufferWriteBuffer is to act as a dynamically-sized WriteBuffer.

Parameters:
cbPreviousTotal - the total number of bytes of capacity of the WriteBuffer objects that the MultiBufferWriteBuffer has thus far consumed
Returns:
an empty WriteBuffer suitable for writing to

release

void release(WriteBuffer buffer)
Returns a WriteBuffer to the pool. This can happen when AbstractWriteBuffer.clear(), or AbstractWriteBuffer.retain(int), or MultiBufferWriteBuffer.retain(int, int) is called.

Parameters:
buffer - the WriteBuffer that is no longer being used

Oracle® Coherence Java API Reference
v3.5

E14977-01

Copyright © 2000, 2009, Oracle. All rights reserved.