Minor cleanup.

pull/140/head
Brett Wooldridge 11 years ago
parent 20197fdedf
commit 4f888e8c60

@ -110,7 +110,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
/** {@inheritDoc} */
@Override
public final void checkException(SQLException sqle)
public final SQLException checkException(SQLException sqle)
{
String sqlState = sqle.getSQLState();
if (sqlState != null) {
@ -123,6 +123,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
checkException(sqle.getNextException());
}
}
return sqle;
}
/** {@inheritDoc} */
@ -222,7 +223,6 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
}
catch (SQLException e) {
checkException(e);
throw e;
}
finally {
parentPool.releaseConnection(bagEntry, forceClose);
@ -247,8 +247,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -262,8 +261,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -277,8 +275,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -292,8 +289,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyCallableStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -307,8 +303,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyCallableStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -323,8 +318,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyCallableStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -338,8 +332,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -353,8 +346,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -369,8 +361,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -386,8 +377,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -401,8 +391,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -416,8 +405,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -433,8 +421,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return delegate.isValid(timeout);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -448,8 +435,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
isAutoCommitDirty = (autoCommit != parentPool.isAutoCommit);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -463,8 +449,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
isReadOnlyDirty = (readOnly != parentPool.isReadOnly);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -478,8 +463,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
isTransactionIsolationDirty = (level != parentPool.transactionIsolation);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -492,8 +476,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
isCatalogDirty = !catalog.equals(parentPool.catalog);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}

@ -51,8 +51,9 @@ public interface IHikariConnectionProxy extends Connection
* a disconnection from the server.
*
* @param sqle the SQLException to check
* @return return the passed in exception
*/
void checkException(SQLException sqle);
SQLException checkException(SQLException sqle);
/**
* Get the expiration timestamp of the connection.

@ -44,8 +44,7 @@ public abstract class PreparedStatementProxy extends StatementProxy implements P
return ((PreparedStatement) delegate).executeQuery();
}
catch (SQLException e) {
connection.checkException(e);
throw e;
throw connection.checkException(e);
}
}
}

@ -40,11 +40,6 @@ public abstract class StatementProxy implements Statement
this.delegate = statement;
}
protected final void checkException(SQLException e)
{
connection.checkException(e);
}
// **********************************************************************
// Overridden java.sql.Statement Methods
// **********************************************************************
@ -64,8 +59,7 @@ public abstract class StatementProxy implements Statement
delegate.close();
}
catch (SQLException e) {
connection.checkException(e);
throw e;
throw connection.checkException(e);
}
}
@ -77,8 +71,7 @@ public abstract class StatementProxy implements Statement
return delegate.executeQuery(sql);
}
catch (SQLException e) {
connection.checkException(e);
throw e;
throw connection.checkException(e);
}
}
@ -90,8 +83,7 @@ public abstract class StatementProxy implements Statement
return delegate.getResultSet();
}
catch (SQLException e) {
connection.checkException(e);
throw e;
throw connection.checkException(e);
}
}
@ -103,8 +95,7 @@ public abstract class StatementProxy implements Statement
return delegate.getGeneratedKeys();
}
catch (SQLException e) {
connection.checkException(e);
throw e;
throw connection.checkException(e);
}
}

@ -108,9 +108,10 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
executorService.schedule(leakTask, leakDetectionThreshold, TimeUnit.MILLISECONDS);
}
/** {@inheritDoc} */
/** {@inheritDoc}
* @return */
@Override
public final void checkException(SQLException sqle)
public final SQLException checkException(SQLException sqle)
{
String sqlState = sqle.getSQLState();
if (sqlState != null) {
@ -123,6 +124,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
checkException(sqle.getNextException());
}
}
return sqle;
}
/** {@inheritDoc} */
@ -221,8 +223,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
resetConnectionState();
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
finally {
parentPool.releaseConnection(bagEntry, forceClose);
@ -247,8 +248,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -262,8 +262,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -277,8 +276,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -292,8 +290,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyCallableStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -307,8 +304,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyCallableStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -323,8 +319,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyCallableStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -338,8 +333,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -353,8 +347,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -369,8 +362,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -386,8 +378,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -401,8 +392,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -416,8 +406,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return trackStatement(proxyPreparedStatement);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -433,8 +422,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return delegate.isValid(timeout);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -448,8 +436,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
isAutoCommitDirty = (autoCommit != parentPool.isAutoCommit);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -463,8 +450,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
isReadOnlyDirty = (readOnly != parentPool.isReadOnly);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -478,8 +464,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
isTransactionIsolationDirty = (level != parentPool.transactionIsolation);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}
@ -492,8 +477,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
isCatalogDirty = !catalog.equals(parentPool.catalog);
}
catch (SQLException e) {
checkException(e);
throw e;
throw checkException(e);
}
}

@ -51,8 +51,9 @@ public interface IHikariConnectionProxy extends Connection
* a disconnection from the server.
*
* @param sqle the SQLException to check
* @return return the passed in exception
*/
void checkException(SQLException sqle);
SQLException checkException(SQLException sqle);
/**
* Return the broken state of the connection. If checkException() detected

@ -44,8 +44,7 @@ public abstract class PreparedStatementProxy extends StatementProxy implements P
return ((PreparedStatement) delegate).executeQuery();
}
catch (SQLException e) {
connection.checkException(e);
throw e;
throw connection.checkException(e);
}
}
}

@ -40,11 +40,6 @@ public abstract class StatementProxy implements Statement
this.delegate = statement;
}
protected final void checkException(SQLException e)
{
connection.checkException(e);
}
// **********************************************************************
// Overridden java.sql.Statement Methods
// **********************************************************************
@ -64,8 +59,7 @@ public abstract class StatementProxy implements Statement
delegate.close();
}
catch (SQLException e) {
connection.checkException(e);
throw e;
throw connection.checkException(e);
}
}
@ -77,8 +71,7 @@ public abstract class StatementProxy implements Statement
return delegate.executeQuery(sql);
}
catch (SQLException e) {
connection.checkException(e);
throw e;
throw connection.checkException(e);
}
}
@ -90,8 +83,7 @@ public abstract class StatementProxy implements Statement
return delegate.getResultSet();
}
catch (SQLException e) {
connection.checkException(e);
throw e;
throw connection.checkException(e);
}
}
@ -103,8 +95,7 @@ public abstract class StatementProxy implements Statement
return delegate.getGeneratedKeys();
}
catch (SQLException e) {
connection.checkException(e);
throw e;
throw connection.checkException(e);
}
}

Loading…
Cancel
Save