org.codehaus.activemq.journal.impl
Class ByteBufferPool

java.lang.Object
  extended byorg.codehaus.activemq.journal.impl.ByteBufferPool

public class ByteBufferPool
extends Object

Provides a simple pool of ByteBuffer objects.

Version:
$Revision: 1.1 $

Constructor Summary
ByteBufferPool()
          Creates a pool of 4 x 4 Meg ByteBuffers
ByteBufferPool(int bufferCount, int bufferSize)
          Creates a pool of bufferCount ByteBuffers that are directly allocated being bufferSize big.
 
Method Summary
 ByteBuffer getByteBuffer()
          Blocks until a ByteBuffer can be retreived from the pool.
 void returnByteBuffer(ByteBuffer buffer)
          Returns a ByteBuffer to the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBufferPool

public ByteBufferPool()
Creates a pool of 4 x 4 Meg ByteBuffers


ByteBufferPool

public ByteBufferPool(int bufferCount,
                      int bufferSize)
Creates a pool of bufferCount ByteBuffers that are directly allocated being bufferSize big.

Parameters:
bufferCount - the number of buffers that will be in the pool.
bufferSize - the size of the buffers that are in the pool.
Method Detail

getByteBuffer

public ByteBuffer getByteBuffer()
                         throws InterruptedException
Blocks until a ByteBuffer can be retreived from the pool.

Returns:
Throws:
InterruptedException

returnByteBuffer

public void returnByteBuffer(ByteBuffer buffer)
Returns a ByteBuffer to the pool.

Parameters:
buffer -


Copyright © 2004 Protique, Ltd.. All Rights Reserved.