提交 c5c89f63 authored 作者: Thomas Mueller's avatar Thomas Mueller

Closing a Statement or PreparedStatement at the same time as executing a…

Closing a Statement or PreparedStatement at the same time as executing a statement could throw a strange exception.
上级 90c23518
......@@ -297,11 +297,15 @@ public class JdbcConnection extends TraceObject implements Connection {
if (session == null) {
return;
}
synchronized (session) {
if (executingStatement != null) {
session.cancel();
if (executingStatement != null) {
try {
executingStatement.cancel();
} catch (NullPointerException e) {
// ignore
}
session.cancel();
}
synchronized (session) {
try {
if (!session.isClosed()) {
try {
......
......@@ -82,8 +82,11 @@ public class TestConcurrent extends TestBase {
conn.close();
t.join();
SQLException e = ex[0];
if (e != null && ErrorCode.OBJECT_CLOSED != e.getErrorCode()) {
throw e;
if (e != null) {
if (ErrorCode.OBJECT_CLOSED != e.getErrorCode() &&
ErrorCode.STATEMENT_WAS_CANCELED != e.getErrorCode()) {
throw e;
}
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论