org.javaWebGen.util
Class ObjectPool

java.lang.Object
  extended by org.javaWebGen.util.ObjectPool
Direct Known Subclasses:
OldJDBCConnectionPool, SocketPool

public abstract class ObjectPool
extends java.lang.Object

Generic class for handling Object pooling

Version:
$Revision: 1.2 $
Author:
Kevin Scott

Constructor Summary
protected ObjectPool()
           
protected ObjectPool(int time)
           
 
Method Summary
protected  void checkIn(java.lang.Object o)
          return an object from the pool
protected  java.lang.Object checkOut()
          get an object from the pool
protected  void cleanUp()
          check to see if it can be expired
protected abstract  java.lang.Object create()
           
protected abstract  void expire(java.lang.Object o)
          expire the object in the pool (remove it)
protected  void setPoolSize(int size)
           
protected  void setRecyleTime(long milis)
           
protected abstract  boolean validate(java.lang.Object o)
          validate the object is valid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectPool

protected ObjectPool()

ObjectPool

protected ObjectPool(int time)
Parameters:
time - in seconds to expire a object in the pool
Method Detail

setRecyleTime

protected void setRecyleTime(long milis)
Parameters:
milis - time in mili seconds to expire a object in the pool

setPoolSize

protected void setPoolSize(int size)
Parameters:
size - size of pool

create

protected abstract java.lang.Object create()
                                    throws java.lang.Exception
Throws:
java.lang.Exception

validate

protected abstract boolean validate(java.lang.Object o)
validate the object is valid

Parameters:
o - the object to check

expire

protected abstract void expire(java.lang.Object o)
expire the object in the pool (remove it)

Parameters:
o - the object to check

checkOut

protected java.lang.Object checkOut()
                             throws java.lang.Exception
get an object from the pool

Returns:
object from pool
Throws:
java.lang.Exception

checkIn

protected void checkIn(java.lang.Object o)
return an object from the pool

Parameters:
o - object from pool

cleanUp

protected void cleanUp()
check to see if it can be expired



Copyright(C) 2003-2006 Kevin Scott - All Rights Reserved.