Oracle® Coherence Java API Reference
v3.5

E14977-01

com.tangosol.io
Class ByteArrayWriteBuffer.Allocator

java.lang.Object
  extended by com.tangosol.io.ByteArrayWriteBuffer.Allocator
All Implemented Interfaces:
MultiBufferWriteBuffer.WriteBufferPool
Enclosing class:
ByteArrayWriteBuffer

public static class ByteArrayWriteBuffer.Allocator
extends java.lang.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
protected  int m_cb
          The capacity of the buffers to be returned.
 
Constructor Summary
ByteArrayWriteBuffer.Allocator(int cb)
          Construct an Allocator for ByteArrayWriteBuffers of a given size.
 
Method Summary
 WriteBuffer allocate(int cbPreviousTotal)
          Return a new ByteArrayWrite.
 int getMaximumCapacity()
          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 Detail

m_cb

protected int m_cb
The capacity of the buffers to be returned.

Constructor Detail

ByteArrayWriteBuffer.Allocator

public ByteArrayWriteBuffer.Allocator(int cb)
Construct an Allocator for ByteArrayWriteBuffers of a given size.

Parameters:
cb - the capacity of the buffers to be returned
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)
Return a new ByteArrayWrite.

Specified by:
allocate in interface MultiBufferWriteBuffer.WriteBufferPool
Parameters:
cbPreviousTotal - unused
Returns:
a new ByteArrayWrite

release

public void release(WriteBuffer buffer)
Release the supplied buffer into the pool.

This method is a no op.

Specified by:
release in interface MultiBufferWriteBuffer.WriteBufferPool
Parameters:
buffer - the buffer to release to the pool

Oracle® Coherence Java API Reference
v3.5

E14977-01

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