Package org.apache.commons.pool2.proxy
Class BaseProxyHandler<T>
- java.lang.Object
-
- org.apache.commons.pool2.proxy.BaseProxyHandler<T>
-
- Type Parameters:
T- type of the wrapped pooled object
- Direct Known Subclasses:
CglibProxyHandler,JdkProxyHandler
class BaseProxyHandler<T> extends Object
Base implementation for object wrappers when using aProxiedObjectPool.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description BaseProxyHandler(T pooledObject, UsageTracking<T> usageTracking)Constructs a new wrapper for the given pooled object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) TdisableProxy()Disable the proxy wrapper.(package private) ObjectdoInvoke(Method method, Object[] args)Invoke the given method on the wrapped object.(package private) TgetPooledObject()Gets the wrapped, pooled object.StringtoString()(package private) voidvalidateProxiedObject()Check that the proxy is still valid (i.e.
-
-
-
Constructor Detail
-
BaseProxyHandler
BaseProxyHandler(T pooledObject, UsageTracking<T> usageTracking)
Constructs a new wrapper for the given pooled object.- Parameters:
pooledObject- The object to wrapusageTracking- The instance, if any (usually the object pool) to be provided with usage tracking information for this wrapped object
-
-
Method Detail
-
disableProxy
T disableProxy()
Disable the proxy wrapper. Called when the object has been returned to the pool. Further use of the wrapper should result in anIllegalStateException.- Returns:
- the object that this proxy was wrapping
-
doInvoke
Object doInvoke(Method method, Object[] args) throws Throwable
Invoke the given method on the wrapped object.- Parameters:
method- The method to invokeargs- The arguments to the method- Returns:
- The result of the method call
- Throws:
Throwable- If the method invocation fails
-
getPooledObject
T getPooledObject()
Gets the wrapped, pooled object.- Returns:
- the underlying pooled object
-
validateProxiedObject
void validateProxiedObject()
Check that the proxy is still valid (i.e. thatdisableProxy()has not been called).- Throws:
IllegalStateException- ifdisableProxy()has been called
-
-