Class StatementFinalizer.CloseAwareProxy

java.lang.Object
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer.CloseAwareProxy
All Implemented Interfaces:
InvocationHandler
Enclosing class:
StatementFinalizer

protected class StatementFinalizer.CloseAwareProxy extends Object implements InvocationHandler
Thin proxy around a tracked statement. Every call is delegated unchanged; only close() is reacted to, by forgetting the tracked entry so that a statement the application closed properly neither lingers in the list nor is touched again when the connection is returned.

Object.equals(Object) and hashCode() are answered on the handle itself, as ProxyConnection and the pool's other statement proxies answer them: the handle equals only itself and hashes at its own identity. A container that holds this handle next to an unwrapped handle for the same statement therefore holds two elements, whichever of the two was added first, instead of resolving the pair to one element or the other by insertion order. The statement underneath stays a distinct object that the handle compares equal to in neither direction; reaching it is unwrap's purpose, and there the driver's own equality applies, as it does for the statement facade's handle above.