more proxy cleanup

pull/1/head
Brett Wooldridge 11 years ago
parent 494ea84b86
commit 93e88d758b

@ -31,7 +31,6 @@ public class CallableStatementProxy extends HikariProxyBase<CallableStatement>
protected CallableStatementProxy(ConnectionProxy connection, CallableStatement statement)
{
super(statement);
this.proxy = this;
this.connection = connection;
}
@ -59,17 +58,17 @@ public class CallableStatementProxy extends HikariProxyBase<CallableStatement>
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 */

@ -59,7 +59,6 @@ public class ConnectionProxy extends HikariProxyBase<Connection> implements IHik
{
super(connection);
this.parentPool = parentPool;
this.proxy = this;
}
void unregisterStatement(Object statement)
@ -151,7 +150,7 @@ public class ConnectionProxy extends HikariProxyBase<Connection> implements IHik
finally
{
openStatements.clear();
parentPool.releaseConnection((IHikariConnectionProxy) proxy);
parentPool.releaseConnection(this);
}
}
}

@ -25,8 +25,6 @@ import java.sql.SQLException;
*/
public abstract class HikariProxyBase<T>
{
protected Object proxy;
final protected T delegate;
protected HikariProxyBase(T delegate)
@ -34,12 +32,6 @@ public abstract class HikariProxyBase<T>
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)

@ -31,7 +31,6 @@ public class PreparedStatementProxy extends HikariProxyBase<PreparedStatement>
protected PreparedStatementProxy(ConnectionProxy connection, PreparedStatement statement)
{
super(statement);
this.proxy = this;
this.connection = connection;
}
@ -52,7 +51,7 @@ public class PreparedStatementProxy extends HikariProxyBase<PreparedStatement>
return;
}
connection.unregisterStatement(proxy);
connection.unregisterStatement(this);
delegate.close();
}
@ -63,7 +62,7 @@ public class PreparedStatementProxy extends HikariProxyBase<PreparedStatement>
{
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<PreparedStatement>
{
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<PreparedStatement>
{
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<PreparedStatement>
{
return null;
}
return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), generatedKeys);
return ProxyFactory.INSTANCE.getProxyResultSet((PreparedStatement) this, generatedKeys);
}
/* java.sql.Wrapper implementation */

@ -30,7 +30,6 @@ public class ResultSetProxy extends HikariProxyBase<ResultSet>
protected ResultSetProxy(Statement statement, ResultSet resultSet)
{
super(resultSet);
this.proxy = this;
this.statement = statement;
}

@ -30,7 +30,6 @@ public class StatementProxy extends HikariProxyBase<Statement>
protected StatementProxy(ConnectionProxy connection, Statement statement)
{
super(statement);
this.proxy = this;
this.connection = connection;
}
@ -51,7 +50,7 @@ public class StatementProxy extends HikariProxyBase<Statement>
return;
}
connection.unregisterStatement(proxy);
connection.unregisterStatement(this);
delegate.close();
}
@ -62,7 +61,8 @@ public class StatementProxy extends HikariProxyBase<Statement>
{
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<Statement>
{
return null;
}
return ProxyFactory.INSTANCE.getProxyResultSet(this.getProxy(), generatedKeys);
return ProxyFactory.INSTANCE.getProxyResultSet((Statement) this, generatedKeys);
}
/* java.sql.Wrapper implementation */

@ -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
{
}
Loading…
Cancel
Save