mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修正connection.close的并发问题
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@326 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -31,6 +31,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
private final Statement stmt;
|
||||
protected PoolableConnection conn;
|
||||
protected final List<ResultSet> resultSetTrace = new ArrayList<ResultSet>();
|
||||
protected boolean closed = false;
|
||||
|
||||
public PoolableStatement(PoolableConnection conn, Statement stmt){
|
||||
this.conn = conn;
|
||||
@@ -49,6 +50,10 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
this.conn = conn;
|
||||
}
|
||||
|
||||
public Statement getStatement() {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
protected void clearResultSet() {
|
||||
for (ResultSet rs : resultSetTrace) {
|
||||
try {
|
||||
@@ -90,6 +95,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
clearResultSet();
|
||||
|
||||
stmt.close();
|
||||
this.closed = true;
|
||||
|
||||
conn.getConnectionHolder().removeTrace(this);
|
||||
}
|
||||
@@ -409,6 +415,10 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
|
||||
@Override
|
||||
public final boolean isClosed() throws SQLException {
|
||||
if (this.closed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
return stmt.isClosed();
|
||||
} catch (Throwable t) {
|
||||
|
||||
Reference in New Issue
Block a user