From 89a475af1497ceb42b03b701dda4d864ca51787a Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Fri, 8 Nov 2013 14:47:04 +0900 Subject: [PATCH] documentation and dead code removal --- .../zaxxer/hikari/proxy/ConnectionProxy.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java b/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java index 2284571a..82e19074 100644 --- a/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java +++ b/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java @@ -32,18 +32,23 @@ import com.zaxxer.hikari.javassist.HikariInject; import com.zaxxer.hikari.javassist.HikariOverride; /** - * This is the proxy class for java.sql.Connection. It is used in - * two ways: + * This is the proxy class for java.sql.Connection. It is used in two ways: * * 1) If instrumentation is not used, Javassist will generate a new class * that extends this class and delegates all method calls to the 'delegate' * member (which points to the real Connection). * * 2) If instrumentation IS used, Javassist will be used to inject all of - * the non-final methods of this class into the actual Connection implementation - * provided by the JDBC driver. All of the fields, except for PROXY_FACTORY - * and 'delegate' are also injected. In order to avoid name conflicts the - * fields of this class have slightly unconventional names. + * the &HikariInject and &HikariOverride annotated fields and methods + * of this class into the actual Connection implementation provided by the + * JDBC driver. In order to avoid name conflicts some of the fields and + * methods are prefixed with _ or __. + * + * Methods prefixed with __, like __createStatement() are especially + * important because when we inject out own createStatement() into the + * target implementation, the original method is renamed to __createStatement() + * so that the call operates the same whether delegation or instrumentation + * is used. * * @author Brett Wooldridge */ @@ -77,6 +82,8 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy, Connect SQL_ERRORS.add("57P02"); // CRASH SHUTDOWN SQL_ERRORS.add("01002"); // SQL92 disconnect error + // This is important when injecting in instrumentation mode. Do not change + // this name without also fixing the HikariClassTransformer. __static(); } @@ -84,6 +91,8 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy, Connect { this.delegate = connection; + // This is important when injecting in instrumentation mode. Do not change + // this name without also fixing the HikariClassTransformer. __init(); } @@ -187,11 +196,6 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy, Connect return statement; } - public final Connection getDelegate() - { - return delegate; - } - // ********************************************************************** // "Overridden" java.sql.Connection Methods // **********************************************************************