Top Description Fields Constructors Methods
org.apache.commons.pool2.proxy

pack-priv Class BaseProxyHandler<T>

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.pool2.proxy.CglibProxyHandler, org.apache.commons.pool2.proxy.JdkProxyHandler
Type Parameters
<T>
type of the wrapped pooled object
Imports
java.lang.reflect.Method, org.apache.commons.pool2.UsageTracking

Base implementation for object wrappers when using a ProxiedObjectPool.
Since
2.0

Field Summary

Modifier and TypeField and Description
private volatile T
private final UsageTracking<T>

Constructor Summary

AccessConstructor and Description
pack-priv
BaseProxyHandler(final T
The object to wrap
pooledObject
,
final UsageTracking<T>
The instance, if any (usually the object pool) to be provided with usage tracking information for this wrapped object
usageTracking
)

Constructs a new wrapper for the given pooled object.

Method Summary

Modifier and TypeMethod and Description
pack-priv T

Returns:

the object that this proxy was wrapping
disableProxy
()

Disable the proxy wrapper.

pack-priv Object

Returns:

The result of the method call
doInvoke
(final Method
The method to invoke
method
,
final Object[]
The arguments to the method
args
)

Invoke the given method on the wrapped object.

pack-priv T

Returns:

the underlying pooled object
getPooledObject
()

Gets the wrapped, pooled object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
pack-priv void
validateProxiedObject()

Check that the proxy is still valid (i.e. that disableProxy() has not been called).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

pooledObjectback to summary
private volatile T pooledObject
usageTrackingback to summary
private final UsageTracking<T> usageTracking

Constructor Detail

BaseProxyHandlerback to summary
pack-priv BaseProxyHandler(final T pooledObject, final UsageTracking<T> usageTracking)

Constructs a new wrapper for the given pooled object.

Parameters
pooledObject:T

The object to wrap

usageTracking:UsageTracking<T>

The instance, if any (usually the object pool) to be provided with usage tracking information for this wrapped object

Method Detail

disableProxyback to summary
pack-priv T disableProxy()

Disable the proxy wrapper. Called when the object has been returned to the pool. Further use of the wrapper should result in an IllegalStateException.

Returns:T

the object that this proxy was wrapping

doInvokeback to summary
pack-priv Object doInvoke(final Method method, final Object[] args) throws Throwable

Invoke the given method on the wrapped object.

Parameters
method:Method

The method to invoke

args:Object[]

The arguments to the method

Returns:Object

The result of the method call

Exceptions
Throwable:
If the method invocation fails
getPooledObjectback to summary
pack-priv T getPooledObject()

Gets the wrapped, pooled object.

Returns:T

the underlying pooled object

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
Since
2.4.3
validateProxiedObjectback to summary
pack-priv void validateProxiedObject()

Check that the proxy is still valid (i.e. that disableProxy() has not been called).

Exceptions
IllegalStateException:
if disableProxy() has been called