PooliT v2.0

org.ascentphase.poolit.poolers
Class DisposablePooler

java.lang.Object
  extended byorg.ascentphase.poolit.poolers.DisposablePooler
All Implemented Interfaces:
Pooler

public class DisposablePooler
extends java.lang.Object
implements Pooler

This pooler acts as a memory-sensitive pool. It will pool objects as long as there is enough memory to do so. If the Java VM is low on memory and performs a garbage-collecting sweep, one or more or all objects in this pool may be garbage-collected to free up available memory for other parts of the application to use. This class is convenient to use if you create many objects of a specific type that can be re-used but should be disposed to free up memory if required.

Author:
huyd

Field Summary
protected  PoolHandler handler
           
 
Constructor Summary
DisposablePooler(PoolHandler hnd)
          Creates a new instance of DisposablePooler
 
Method Summary
 void close()
          Releases all objects in the pool and any resources held by these objects.
 java.lang.Object fetch()
          Retrieves an object from the pool.
 void release(java.lang.Object o)
          Returns an object to the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handler

protected PoolHandler handler
Constructor Detail

DisposablePooler

public DisposablePooler(PoolHandler hnd)
Creates a new instance of DisposablePooler

Method Detail

fetch

public java.lang.Object fetch()
                       throws FetchException
Retrieves an object from the pool.

Specified by:
fetch in interface Pooler
Returns:
an object from the pool
Throws:
FetchException - if the pooler is unable to return an object from the pool.

release

public void release(java.lang.Object o)
Returns an object to the pool.

Specified by:
release in interface Pooler
Parameters:
o - the object

close

public void close()
Description copied from interface: Pooler
Releases all objects in the pool and any resources held by these objects.

Specified by:
close in interface Pooler
See Also:
Pooler.close()

PooliT v2.0

Copyright © 2005 Ascent Phase Corp.