org.jppf.utils.pooling
Class DirectBufferPoolQueue

java.lang.Object
  extended by org.jppf.utils.pooling.DirectBufferPoolQueue
All Implemented Interfaces:
ObjectPool<ByteBuffer>

public class DirectBufferPoolQueue
extends Object
implements ObjectPool<ByteBuffer>

A ByteBuffer pool backed by a ConcurrentLinkedQueue.

Author:
Laurent Cohen

Constructor Summary
DirectBufferPoolQueue()
           
 
Method Summary
 ByteBuffer get()
          Get an object from the pool, or create it if the pool is empty.
 boolean isEmpty()
          Determine whether this pool is empty.
 void put(ByteBuffer buffer)
          Release an object into this pool, and make it availble.
 int size()
          Use this method with precaution, as its performance is in O(n).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectBufferPoolQueue

public DirectBufferPoolQueue()
Method Detail

get

public ByteBuffer get()
Get an object from the pool, or create it if the pool is empty.

Specified by:
get in interface ObjectPool<ByteBuffer>
Returns:
a new Object of the type handled by this pool.

put

public void put(ByteBuffer buffer)
Release an object into this pool, and make it availble.

Specified by:
put in interface ObjectPool<ByteBuffer>
Parameters:
buffer - the object to release.

isEmpty

public boolean isEmpty()
Determine whether this pool is empty.

Specified by:
isEmpty in interface ObjectPool<ByteBuffer>
Returns:
true if the pool is empty, false otherwise.

size

public int size()
Use this method with precaution, as its performance is in O(n).
Get the number of objects in this pool. This is an optional operation, as it may not always be done in constant time.

Specified by:
size in interface ObjectPool<ByteBuffer>
Returns:
the size of this pool, or -1 if this operation is not supported.


Copyright © 2005-2010 JPPF Team.