rcx.josx.util
Class ArrayRecycler

java.lang.Object
  extended by rcx.josx.util.Recycler
      extended by rcx.josx.util.ArrayRecycler

public final class ArrayRecycler
extends Recycler

An abstract array recycler.

Note that the caller is expected to provide thread safety for instances of this class.

See Also:
RecyclableArray

Constructor Summary
ArrayRecycler()
          Constructs a recycler.
 
Method Summary
 RecyclableArray allocate(int length)
          Attempts to obtain a free RecyclableArray.
 
Methods inherited from class rcx.josx.util.Recycler
allocate, recycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayRecycler

public ArrayRecycler()
Constructs a recycler.

Parameters:
capacity - Maximum number of allocated (non garbage) objects at any given time.
Method Detail

allocate

public final RecyclableArray allocate(int length)
Attempts to obtain a free RecyclableArray.

Returns:
A RecyclableArray reference.
Throws:
java.lang.StackOverflowError - May be thrown due to the recursive implementation of the method.