more cleanup

pull/423/head
Nitin 10 years ago
parent ff8e54c56f
commit cc3f8614af

@ -77,7 +77,7 @@ abstract class PoolBase
initializeDataSource(); initializeDataSource();
} }
public String getPoolName() String getPoolName()
{ {
return poolName; return poolName;
} }
@ -88,7 +88,7 @@ abstract class PoolBase
// JDBC methods // JDBC methods
// *********************************************************************** // ***********************************************************************
public void quietlyCloseConnection(final Connection connection, final String closureReason) void quietlyCloseConnection(final Connection connection, final String closureReason)
{ {
try { try {
if (connection == null || connection.isClosed()) { if (connection == null || connection.isClosed()) {
@ -109,7 +109,7 @@ abstract class PoolBase
} }
} }
public boolean isConnectionAlive(final Connection connection) boolean isConnectionAlive(final Connection connection)
{ {
try { try {
final long validationTimeout = config.getValidationTimeout(); final long validationTimeout = config.getValidationTimeout();
@ -143,17 +143,16 @@ abstract class PoolBase
} }
} }
public DataSource getUnwrappedDataSource() Throwable getLastConnectionFailure()
{ {
return dataSource; return lastConnectionFailure.getAndSet(null);
} }
public Throwable getLastConnectionFailure() public DataSource getUnwrappedDataSource()
{ {
return lastConnectionFailure.getAndSet(null); return dataSource;
} }
// *********************************************************************** // ***********************************************************************
// PoolEntry methods // PoolEntry methods
// *********************************************************************** // ***********************************************************************
@ -163,7 +162,7 @@ abstract class PoolBase
return new PoolEntry(newConnection(), this); return new PoolEntry(newConnection(), this);
} }
public void resetConnectionState(final Connection connection, final ProxyConnection proxyConnection, final int dirtyBits) throws SQLException void resetConnectionState(final Connection connection, final ProxyConnection proxyConnection, final int dirtyBits) throws SQLException
{ {
int resetBits = 0; int resetBits = 0;
@ -200,9 +199,15 @@ abstract class PoolBase
} }
} }
void shutdownNetworkTimeoutExecutor()
{
if (netTimeoutExecutor != null && netTimeoutExecutor instanceof ThreadPoolExecutor) {
((ThreadPoolExecutor) netTimeoutExecutor).shutdownNow();
}
}
// *********************************************************************** // ***********************************************************************
// PoolMediator methods // JMX methods
// *********************************************************************** // ***********************************************************************
/** /**
@ -258,13 +263,6 @@ abstract class PoolBase
} }
} }
public void shutdownNetworkTimeoutExecutor()
{
if (netTimeoutExecutor != null && netTimeoutExecutor instanceof ThreadPoolExecutor) {
((ThreadPoolExecutor) netTimeoutExecutor).shutdownNow();
}
}
// *********************************************************************** // ***********************************************************************
// Private methods // Private methods
// *********************************************************************** // ***********************************************************************

@ -81,12 +81,12 @@ public final class PoolEntry implements IConcurrentBagEntry
return ProxyFactory.getProxyConnection(this, connection, openStatements, leakTask, now); return ProxyFactory.getProxyConnection(this, connection, openStatements, leakTask, now);
} }
public void resetConnectionState(final ProxyConnection proxyConnection, final int dirtyBits) throws SQLException void resetConnectionState(final ProxyConnection proxyConnection, final int dirtyBits) throws SQLException
{ {
poolBase.resetConnectionState(connection, proxyConnection, dirtyBits); poolBase.resetConnectionState(connection, proxyConnection, dirtyBits);
} }
public String getPoolName() String getPoolName()
{ {
return poolBase.getPoolName(); return poolBase.getPoolName();
} }
@ -96,7 +96,7 @@ public final class PoolEntry implements IConcurrentBagEntry
return connection; return connection;
} }
public boolean isEvicted() boolean isEvicted()
{ {
return evict; return evict;
} }

@ -96,30 +96,30 @@ public abstract class ProxyConnection implements Connection
} }
// *********************************************************************** // ***********************************************************************
// Live Connection State accessors // Connection State Accessors
// *********************************************************************** // ***********************************************************************
public final boolean getAutoCommitState() final boolean getAutoCommitState()
{ {
return isAutoCommit; return isAutoCommit;
} }
public final String getCatalogState() final String getCatalogState()
{ {
return dbcatalog; return dbcatalog;
} }
public final int getTransactionIsolationState() final int getTransactionIsolationState()
{ {
return transactionIsolation; return transactionIsolation;
} }
public final boolean getReadOnlyState() final boolean getReadOnlyState()
{ {
return isReadOnly; return isReadOnly;
} }
public final int getNetworkTimeoutState() final int getNetworkTimeoutState()
{ {
return networkTimeout; return networkTimeout;
} }
@ -129,13 +129,13 @@ public abstract class ProxyConnection implements Connection
// *********************************************************************** // ***********************************************************************
/** {@inheritDoc} */ /** {@inheritDoc} */
public final PoolEntry getPoolEntry() final PoolEntry getPoolEntry()
{ {
return poolEntry; return poolEntry;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public final SQLException checkException(final SQLException sqle) final SQLException checkException(final SQLException sqle)
{ {
String sqlState = sqle.getSQLState(); String sqlState = sqle.getSQLState();
if (sqlState != null) { if (sqlState != null) {
@ -156,13 +156,13 @@ public abstract class ProxyConnection implements Connection
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public final void untrackStatement(final Statement statement) final void untrackStatement(final Statement statement)
{ {
openStatements.remove(statement); openStatements.remove(statement);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public final void markCommitStateDirty() final void markCommitStateDirty()
{ {
if (isAutoCommit) { if (isAutoCommit) {
lastAccess = clockSource.currentTime(); lastAccess = clockSource.currentTime();

@ -87,7 +87,7 @@ class ProxyLeakTask implements Runnable
LOGGER.warn("Connection leak detection triggered for connection {}, stack trace follows", connectionName, exception); LOGGER.warn("Connection leak detection triggered for connection {}, stack trace follows", connectionName, exception);
} }
public void cancel() void cancel()
{ {
scheduledFuture.cancel(false); scheduledFuture.cancel(false);
} }

@ -39,7 +39,7 @@ public abstract class ProxyResultSet implements ResultSet
this.delegate = resultSet; this.delegate = resultSet;
} }
protected final SQLException checkException(SQLException e) final SQLException checkException(SQLException e)
{ {
return connection.checkException(e); return connection.checkException(e);
} }

@ -40,7 +40,7 @@ public abstract class ProxyStatement implements Statement
this.delegate = statement; this.delegate = statement;
} }
protected final SQLException checkException(SQLException e) final SQLException checkException(SQLException e)
{ {
return connection.checkException(e); return connection.checkException(e);
} }

@ -291,7 +291,7 @@ public class ShutdownTest
Assert.fail(e.getMessage()); Assert.fail(e.getMessage());
} }
finally { finally {
TestElf.getPool(ds).quietlyCloseConnection(connection, "(because this is a test)"); try { connection.close(); } catch (SQLException e) { e.printStackTrace(); }
ds.close(); ds.close();
} }
}; };

Loading…
Cancel
Save