org.d_haven.mpool

Class VariableSizePool

public final class VariableSizePool extends AbstractPool implements ManagablePool

This is an Pool that caches Poolable objects for reuse. Please note that this pool offers no resource limiting whatsoever.

Version: CVS $Revision: 1.9 $ $Date: 2004/06/21 17:03:46 $

Author: Berin Loritsch

Field Summary
LinkedListm_buffer
booleanm_disposed
Constructor Summary
VariableSizePool(ObjectFactory factory, int size)
Create a VariableSizePool with the supplied factory and initial size.
Method Summary
voiddispose()
Dispose of this pool so that it is empty an no longer used.
protected ObjectdoAcquire()
protected booleandoRelease(Object pooledObject)
voidgrow(int byNum)
ObjectpopLast()
voidshrink(int byNum)
intsize()
StringtoString()

Field Detail

m_buffer

private final LinkedList m_buffer

m_disposed

private boolean m_disposed

Constructor Detail

VariableSizePool

public VariableSizePool(ObjectFactory factory, int size)
Create a VariableSizePool with the supplied factory and initial size.

Parameters: factory the factory to use to create objects size the initial number of elements to create

Throws: Exception if there is a problem creating the pooled objects

Method Detail

dispose

public void dispose()
Dispose of this pool so that it is empty an no longer used.

doAcquire

protected Object doAcquire()

doRelease

protected boolean doRelease(Object pooledObject)

grow

public void grow(int byNum)

popLast

private Object popLast()

shrink

public void shrink(int byNum)

size

public int size()

toString

public String toString()