On Thu, 26 Sep 2002 01:47, [EMAIL PROTECTED] wrote:
> 1.1
> jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/mpool/PoolUtil
>.java
>
> Index: PoolUtil.java
> ===================================================================
> /*
> * Created by IntelliJ IDEA.
> * User: bloritsch
> * Date: Sep 25, 2002
> * Time: 11:47:49 AM
> * To change template for new class use
> * Code Style | Class Templates options (Tools | IDE Options).
> */
LICENSE!
> package org.apache.excalibur.mpool;
>
> import java.lang.reflect.Method;
> import java.lang.reflect.Modifier;
>
> public final class PoolUtil
> {
> private final static Object[] EMPTY = new Object[] {};
> private final static Class[] EMPTY_ARGS = new Class[] {};
>
> private PoolUtil() {}
>
> public static Object reset( final Object obj )
> {
> try
> {
> Class klass = obj.getClass();
> Method recycle = klass.getMethod( "recycle", EMPTY_ARGS );
>
> if ( Modifier.isPublic( recycle.getModifiers() ) &&
> recycle.getReturnType().equals( void.class ) )
> {
> recycle.invoke( obj, EMPTY );
> }
I would prefer that you checked if it implemented Recyclable class (also by
reflection). The reason being that I have classes that have a recycle method
that are not Recyclable.
> }
> catch (Exception e)
> {
> // Not a recyclable object--don't worry about it
> }
>
> return obj;
> }
> }
--
Cheers,
Peter Donald
--------------------------------
These aren't the droids you're
looking for. Move along.
--------------------------------
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>