提交 597adf69 authored 作者: andrei's avatar andrei

close connection

上级 325eae3c
...@@ -98,13 +98,17 @@ public class TestConnectionPool extends TestBase { ...@@ -98,13 +98,17 @@ public class TestConnectionPool extends TestBase {
}; };
t.execute(); t.execute();
long time = System.nanoTime(); long time = System.nanoTime();
Connection conn2 = null;
try { try {
// connection 2 (of 1 or 2) may fail // connection 2 (of 1 or 2) may fail
man.getConnection(); conn2 = man.getConnection();
// connection 3 (of 1 or 2) must fail // connection 3 (of 1 or 2) must fail
man.getConnection(); man.getConnection();
fail(); fail();
} catch (SQLException e) { } catch (SQLException e) {
if (conn2 != null) {
conn2.close();
}
assertContains(e.toString().toLowerCase(), "timeout"); assertContains(e.toString().toLowerCase(), "timeout");
time = System.nanoTime() - time; time = System.nanoTime() - time;
assertTrue("timeout after " + TimeUnit.NANOSECONDS.toMillis(time) + assertTrue("timeout after " + TimeUnit.NANOSECONDS.toMillis(time) +
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论