修正connection.close的并发问题

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@326 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-06-30 08:57:37 +00:00
parent bb581829d4
commit fce80a01ad
5 changed files with 152 additions and 10 deletions
@@ -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) {