You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Bradley M. Handy" <br...@williamstonfmc.org> on 2003/06/08 05:17:19 UTC

[pool] Source submission

I have source code for two classes I would like to submit, because I feel 
they would be useful to the commons-pool project.  One is an implementation 
of "PoolableObjectFactory" and the other is a test case for the 
implementation class.

The "PoolableObjectFactory" implementation is called 
"GenericPoolableObjectFactory".  It has to constructors.  The first 
constructor take a parameter of type java.lang.Class representing the class 
of object to be pooled.  The second constructor takes a java.lang.Class 
argument and a java.util.Map argument.  The Map contains a list of keys 
which correspond to properties of the type of object to be pooled which 
will be copied to a newly created object after instantiation using 
Class.newInstance().

The "activeObject", "destroyObject", "passivateObject" and "validateObject" 
methods use reflection to execute a method on the pooled objects.


Factory Method  -> Pooled Object Method

public void activeObject(Object o) throws Exception  -> public void 
activate() throws Exception
public void destroyObject(Object o) throws Exception -> public void 
destroy() throws Exception
public void passivateObject(Object o) throws Exception -> public void 
passivate() throws Exception
public void validateObject() -> public void validate()


Brad Handy