From fb6a7680b94b62465a09a34c213230e14b8807a8 Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Thu, 9 Jan 2014 17:46:14 +0900 Subject: [PATCH] Cleanup and commenting. --- .../zaxxer/hikari/proxy/JavassistProxyFactoryFactory.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactoryFactory.java b/core/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactoryFactory.java index 52f87436..ac6ae306 100644 --- a/core/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactoryFactory.java +++ b/core/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactoryFactory.java @@ -72,8 +72,11 @@ public final class JavassistProxyFactoryFactory try { + // Connection is special, it has a checkClosed() call at the beginning String methodBody = "{ checkClosed(); try { return ((cast) delegate).method($$); } catch (SQLException e) { checkException(e); throw e;} }"; generateProxyClass(Connection.class, ConnectionProxy.class, methodBody); + + // The result of the proxy classes simply delegate methodBody = "{ try { return ((cast) delegate).method($$); } catch (SQLException e) { checkException(e); throw e;} }"; generateProxyClass(Statement.class, StatementProxy.class, methodBody); generateProxyClass(CallableStatement.class, CallableStatementProxy.class, methodBody); @@ -177,9 +180,12 @@ public final class JavassistProxyFactoryFactory continue; } - CtMethod method = CtNewMethod.copy(intfMethod, targetCt, null); + // Track what methods we've added methods.add(intfMethod.getName() + intfMethod.getSignature()); + // Clone the method we want to inject into + CtMethod method = CtNewMethod.copy(intfMethod, targetCt, null); + // Generate a method that simply invokes the same method on the delegate String modifiedBody = methodBody.replace("method", method.getName()); if (method.getReturnType() == CtClass.voidType)