org.jppf.utils.pooling
Interface ObjectPool<E>

Type Parameters:
E -
All Known Implementing Classes:
DirectBufferPoolImpl, DirectBufferPoolQueue

public interface ObjectPool<E>

Author:
Laurent Cohen

Method Summary
 E 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(E content)
          Release an object into this pool, and make it availble.
 int size()
          Get the number of objects in this pool.
 

Method Detail

get

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

Returns:
a new Object of the type handled by this pool.

put

void put(E content)
Release an object into this pool, and make it availble.

Parameters:
content - the object to release.

isEmpty

boolean isEmpty()
Determine whether this pool is empty.

Returns:
true if the pool is empty, false otherwise.

size

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.

Returns:
the size of this pool, or -1 if this operation is not supported.


Copyright © 2005-2010 JPPF Team.