Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.io
Class MultiplexingWriteBufferPool

java.lang.Object
  extended by com.tangosol.io.MultiplexingWriteBufferPool

All Implemented Interfaces:
MultiBufferWriteBuffer.WriteBufferPool, Disposable

public final class MultiplexingWriteBufferPool
extends java.lang.Object
implements MultiBufferWriteBuffer.WriteBufferPool, Disposable

The MultiplexingWriteBufferPool acts as a WriteBufferPool from which a MultiBufferWriteBuffer can allocate and release WriteBuffers from/to.

Author:
ch 2010-03-04

Field Summary
static int DEFAULT_BUF_SIZE
          The default size of the smallest WriteBuffer.

 

Constructor Summary
MultiplexingWriteBufferPool()
          Default constructor.
MultiplexingWriteBufferPool(int cSegments, int cbSegment, int cbBufferMin, int nGrowthFactor)
          Creates a MulitplexingWriteBufferPool.

 

Method Summary
 WriteBuffer allocate(int cbPreviousTotal)
          Allocate a WriteBuffer for use by the MultiBufferWriteBuffer.
 void dispose()
          Invoked when all resources owned by the implementor can safely be released.
 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.

 

Field Detail

DEFAULT_BUF_SIZE

public static final int DEFAULT_BUF_SIZE
The default size of the smallest WriteBuffer. Note that the actual size of the WriteBuffer may be larger, since the size includes an implicit generation ID. Also note that the default buffer size cannot use any of the bits 0-9.
See Also:
Constant Field Values

Constructor Detail

MultiplexingWriteBufferPool

public MultiplexingWriteBufferPool()
Default constructor.

MultiplexingWriteBufferPool

public MultiplexingWriteBufferPool(int cSegments,
                                   int cbSegment,
                                   int cbBufferMin,
                                   int nGrowthFactor)
Creates a MulitplexingWriteBufferPool.
Parameters:
cSegments - the number of segments
cbSegment - the maximum number bytes each segment will consume
cbBufferMin - the smallest buffer size
nGrowthFactor - the segment growth factor

Method Detail

getMaximumCapacity

public int getMaximumCapacity()
Determine the largest amount of aggregate WriteBuffer capacity that this factory can provide.
Specified by:
getMaximumCapacity in interface MultiBufferWriteBuffer.WriteBufferPool
Returns:
the number of bytes that can be stored in the WriteBuffer objects that may be returned from this factory

allocate

public 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.

Specified by:
allocate in interface MultiBufferWriteBuffer.WriteBufferPool
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

public 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.
Specified by:
release in interface MultiBufferWriteBuffer.WriteBufferPool
Parameters:
buffer - the WriteBuffer that is no longer being used

dispose

public void dispose()
Invoked when all resources owned by the implementor can safely be released.
Specified by:
dispose in interface Disposable

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.