org.jppf.utils.pooling
Class DirectBufferPoolImpl

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

public class DirectBufferPoolImpl
extends Object
implements ObjectPool<ByteBuffer>

Author:
Laurent Cohen

Nested Class Summary
static class DirectBufferPoolImpl.LinkedData<E>
           
 
Constructor Summary
DirectBufferPoolImpl()
           
 
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()
          Get the number of objects in this pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectBufferPoolImpl

public DirectBufferPoolImpl()
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()
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.