org.d_haven.mpool
Class ReflectionRecyclePolicy

java.lang.Object
  extended by org.d_haven.mpool.ReflectionRecyclePolicy
All Implemented Interfaces:
RecyclePolicy

public class ReflectionRecyclePolicy
extends java.lang.Object
implements RecyclePolicy

The ReflectionRecyclePolicy allows the user to specify a particular method to use for recycling their pooled objects regardless of whether the object implements any interfaces or not.


Field Summary
private static java.lang.Class[] EMPTY_PARAM_DEFS
           
private static java.lang.Object[] EMPTY_PARAMS
           
private  java.lang.String m_methodName
           
 
Constructor Summary
ReflectionRecyclePolicy(java.lang.String methodName)
          Create the ReflectionRecyclePolicy using the supplied method name as the magic method that gets called when an object is returned to the pool.
 
Method Summary
 void recycle(java.lang.Object pooledObject)
          Recycle the object included.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_methodName

private final java.lang.String m_methodName

EMPTY_PARAM_DEFS

private static final java.lang.Class[] EMPTY_PARAM_DEFS

EMPTY_PARAMS

private static final java.lang.Object[] EMPTY_PARAMS
Constructor Detail

ReflectionRecyclePolicy

public ReflectionRecyclePolicy(java.lang.String methodName)
Create the ReflectionRecyclePolicy using the supplied method name as the magic method that gets called when an object is returned to the pool.

Parameters:
methodName - the name of the method to call
Method Detail

recycle

public void recycle(java.lang.Object pooledObject)
Recycle the object included. If the object is not supposed to recycle at all, then this method does nothing.

Specified by:
recycle in interface RecyclePolicy
Parameters:
pooledObject - the object to recycle

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object