diff --git a/src/main/java/com/zaxxer/hikari/proxy/CallableStatementProxy.java b/src/main/java/com/zaxxer/hikari/proxy/CallableStatementProxy.java index 22da635c..5893b79c 100644 --- a/src/main/java/com/zaxxer/hikari/proxy/CallableStatementProxy.java +++ b/src/main/java/com/zaxxer/hikari/proxy/CallableStatementProxy.java @@ -31,7 +31,6 @@ public class CallableStatementProxy extends HikariProxyBase protected CallableStatementProxy(ConnectionProxy connection, CallableStatement statement) { super(statement); - this.proxy = this; this.connection = connection; } @@ -59,17 +58,17 @@ public class CallableStatementProxy extends HikariProxyBase public ResultSet executeQuery() throws SQLException { - return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), delegate.executeQuery()); + return ProxyFactory.INSTANCE.getProxyResultSet((CallableStatement) this, delegate.executeQuery()); } public ResultSet executeQuery(String sql) throws SQLException { - return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), delegate.executeQuery(sql)); + return ProxyFactory.INSTANCE.getProxyResultSet((CallableStatement) this, delegate.executeQuery(sql)); } public ResultSet getGeneratedKeys() throws SQLException { - return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), delegate.getGeneratedKeys()); + return ProxyFactory.INSTANCE.getProxyResultSet((CallableStatement) this, delegate.getGeneratedKeys()); } /* java.sql.Wrapper implementation */ diff --git a/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java b/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java index ab16312c..2a348710 100644 --- a/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java +++ b/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java @@ -59,7 +59,6 @@ public class ConnectionProxy extends HikariProxyBase implements IHik { super(connection); this.parentPool = parentPool; - this.proxy = this; } void unregisterStatement(Object statement) @@ -151,7 +150,7 @@ public class ConnectionProxy extends HikariProxyBase implements IHik finally { openStatements.clear(); - parentPool.releaseConnection((IHikariConnectionProxy) proxy); + parentPool.releaseConnection(this); } } } diff --git a/src/main/java/com/zaxxer/hikari/proxy/HikariProxyBase.java b/src/main/java/com/zaxxer/hikari/proxy/HikariProxyBase.java index c186ba1e..2fe2053c 100644 --- a/src/main/java/com/zaxxer/hikari/proxy/HikariProxyBase.java +++ b/src/main/java/com/zaxxer/hikari/proxy/HikariProxyBase.java @@ -25,8 +25,6 @@ import java.sql.SQLException; */ public abstract class HikariProxyBase { - protected Object proxy; - final protected T delegate; protected HikariProxyBase(T delegate) @@ -34,12 +32,6 @@ public abstract class HikariProxyBase this.delegate = delegate; } - @SuppressWarnings("unchecked") - protected T getProxy() - { - return (T) proxy; - } - protected abstract SQLException checkException(SQLException e); protected static boolean isWrapperFor(Object obj, Class param) diff --git a/src/main/java/com/zaxxer/hikari/proxy/PreparedStatementProxy.java b/src/main/java/com/zaxxer/hikari/proxy/PreparedStatementProxy.java index aad4491e..7d46c6b2 100644 --- a/src/main/java/com/zaxxer/hikari/proxy/PreparedStatementProxy.java +++ b/src/main/java/com/zaxxer/hikari/proxy/PreparedStatementProxy.java @@ -31,7 +31,6 @@ public class PreparedStatementProxy extends HikariProxyBase protected PreparedStatementProxy(ConnectionProxy connection, PreparedStatement statement) { super(statement); - this.proxy = this; this.connection = connection; } @@ -52,7 +51,7 @@ public class PreparedStatementProxy extends HikariProxyBase return; } - connection.unregisterStatement(proxy); + connection.unregisterStatement(this); delegate.close(); } @@ -63,7 +62,7 @@ public class PreparedStatementProxy extends HikariProxyBase { return null; } - return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), resultSet); + return ProxyFactory.INSTANCE.getProxyResultSet((PreparedStatement) this, resultSet); } public ResultSet executeQuery() throws SQLException @@ -73,7 +72,7 @@ public class PreparedStatementProxy extends HikariProxyBase { return null; } - return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), resultSet); + return ProxyFactory.INSTANCE.getProxyResultSet((PreparedStatement) this, resultSet); } public ResultSet executeQuery(String sql) throws SQLException @@ -83,7 +82,7 @@ public class PreparedStatementProxy extends HikariProxyBase { return null; } - return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), resultSet); + return ProxyFactory.INSTANCE.getProxyResultSet((PreparedStatement) this, resultSet); } public ResultSet getGeneratedKeys() throws SQLException @@ -93,7 +92,7 @@ public class PreparedStatementProxy extends HikariProxyBase { return null; } - return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), generatedKeys); + return ProxyFactory.INSTANCE.getProxyResultSet((PreparedStatement) this, generatedKeys); } /* java.sql.Wrapper implementation */ diff --git a/src/main/java/com/zaxxer/hikari/proxy/ResultSetProxy.java b/src/main/java/com/zaxxer/hikari/proxy/ResultSetProxy.java index 28cc3813..6d0941d5 100644 --- a/src/main/java/com/zaxxer/hikari/proxy/ResultSetProxy.java +++ b/src/main/java/com/zaxxer/hikari/proxy/ResultSetProxy.java @@ -30,7 +30,6 @@ public class ResultSetProxy extends HikariProxyBase protected ResultSetProxy(Statement statement, ResultSet resultSet) { super(resultSet); - this.proxy = this; this.statement = statement; } diff --git a/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java b/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java index 70ca24af..c4ffc250 100644 --- a/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java +++ b/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java @@ -30,7 +30,6 @@ public class StatementProxy extends HikariProxyBase protected StatementProxy(ConnectionProxy connection, Statement statement) { super(statement); - this.proxy = this; this.connection = connection; } @@ -51,7 +50,7 @@ public class StatementProxy extends HikariProxyBase return; } - connection.unregisterStatement(proxy); + connection.unregisterStatement(this); delegate.close(); } @@ -62,7 +61,8 @@ public class StatementProxy extends HikariProxyBase { return null; } - return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), resultSet); + + return ProxyFactory.INSTANCE.getProxyResultSet((Statement) this, resultSet); } public ResultSet getGeneratedKeys() throws SQLException @@ -72,7 +72,8 @@ public class StatementProxy extends HikariProxyBase { return null; } - return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), generatedKeys); + + return ProxyFactory.INSTANCE.getProxyResultSet((Statement) this, generatedKeys); } /* java.sql.Wrapper implementation */ diff --git a/src/main/java/com/zaxxer/hikari/util/PropertyBeanSetter.java b/src/main/java/com/zaxxer/hikari/util/PropertyBeanSetter.java new file mode 100644 index 00000000..06ed582c --- /dev/null +++ b/src/main/java/com/zaxxer/hikari/util/PropertyBeanSetter.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2013 Brett Wooldridge + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.zaxxer.hikari.util; + +/** + * + * @author Brett Wooldridge + */ +public class PropertyBeanSetter +{ + +}