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
Base implementation for object wrappers when using a
ProxiedObjectPool.- Since:
- 2.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBaseProxyHandler(T pooledObject, UsageTracking<T> usageTracking) Constructs a new wrapper for the given pooled object. -
Method Summary
-
Field Details
-
pooledObject
-
usageTracking
-
-
Constructor Details
-
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 Details
-
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
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
-
toString
-
validateProxiedObject
void validateProxiedObject()Check that the proxy is still valid (i.e. thatdisableProxy()has not been called).- Throws:
IllegalStateException- ifdisableProxy()has been called
-