Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-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 ByteArrayWriteBuffer instances to allocate.

 

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

 

Method Summary
 WriteBuffer allocate(int cbPreviousTotal)
          Allocate a new ByteArrayWriteBuffer.
 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 ByteArrayWriteBuffer instances to allocate.

Constructor Detail

ByteArrayWriteBuffer.Allocator

public ByteArrayWriteBuffer.Allocator(int cb)
Construct an Allocator for ByteArrayWriteBuffers of a given size.
Parameters:
cb - the capacity of the ByteArrayWriteBuffer to be allocated

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 new ByteArrayWriteBuffer.
Specified by:
allocate in interface MultiBufferWriteBuffer.WriteBufferPool
Parameters:
cbPreviousTotal - unused
Returns:
a new ByteArrayWriteBuffer of the capacity that was passed to #Allocator(int)

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 - unused

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.