mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
代码重构
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@619 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -66,38 +66,15 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
if (holder != null) {
|
||||
DruidAbstractDataSource dataSource = holder.getDataSource();
|
||||
if (dataSource != null) {
|
||||
holder.getDataSource().handleException(t);
|
||||
holder.getDataSource().handleConnectionException(this, t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (t instanceof SQLException) {
|
||||
SQLException sqlEx = (SQLException) t;
|
||||
|
||||
// broadcastConnectionError
|
||||
ConnectionEvent event = new ConnectionEvent(this, sqlEx);
|
||||
for (ConnectionEventListener eventListener : holder.getConnectionEventListeners()) {
|
||||
eventListener.connectionErrorOccurred(event);
|
||||
}
|
||||
|
||||
// exceptionSorter.isExceptionFatal
|
||||
if (holder != null) {
|
||||
DruidAbstractDataSource dataSource = holder.getDataSource();
|
||||
|
||||
if (dataSource != null) {
|
||||
ExceptionSorter exceptionSorter = dataSource.getExceptionSoter();
|
||||
if (exceptionSorter != null && exceptionSorter.isExceptionFatal(sqlEx)) {
|
||||
if (holder != null) {
|
||||
dataSource.decrementActiveCountWithLock();
|
||||
this.holder = null; // isClosed() is true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw sqlEx;
|
||||
} else {
|
||||
throw new SQLException("Error", t);
|
||||
throw (SQLException) t;
|
||||
}
|
||||
|
||||
throw new SQLException("Error", t);
|
||||
}
|
||||
|
||||
void closePoolableStatement(PoolablePreparedStatement stmt) throws SQLException {
|
||||
@@ -123,6 +100,10 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
public Connection getConnection() {
|
||||
return conn;
|
||||
}
|
||||
|
||||
void disable() {
|
||||
this.holder = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws SQLException {
|
||||
|
||||
Reference in New Issue
Block a user