1 21 package oracle.toplink.essentials.internal.ejb.cmp3.jdbc.base; 23 24 import java.lang.reflect.InvocationHandler ; 25 import java.lang.reflect.Method ; 26 import java.sql.Connection ; 27 28 35 public class ConnectionProxyHandler implements InvocationHandler { 36 Connection connection; 37 38 39 40 41 private void debug(String s) { 42 System.out.println(s); 43 } 44 45 48 public ConnectionProxyHandler(Connection connection) { 49 this.connection = connection; 50 } 51 52 53 54 55 56 59 public Object invoke(Object proxy, Method method, Object [] args) throws Throwable { 60 String methodName = method.getName(); 61 debug("PROXY method: " + methodName); 62 if (methodName.equals("close") || methodName.equals("commit") || methodName.equals("rollback")) { 64 return null; 65 } 66 67 return method.invoke(connection, args); 69 } 70 } 71 | Popular Tags |