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

Improved test case (sometimes the thread was not yet started before calling cancel()).

上级 27e607d4
...@@ -257,7 +257,7 @@ public class TestPreparedStatement extends TestBase { ...@@ -257,7 +257,7 @@ public class TestPreparedStatement extends TestBase {
private void testCancelReuse(Connection conn) throws Exception { private void testCancelReuse(Connection conn) throws Exception {
conn.createStatement().execute("CREATE ALIAS YIELD FOR \"java.lang.Thread.yield\""); conn.createStatement().execute("CREATE ALIAS YIELD FOR \"java.lang.Thread.yield\"");
final PreparedStatement prep = conn.prepareStatement("SELECT YIELD() FROM SYSTEM_RANGE(1, 1000000) LIMIT ?"); final PreparedStatement prep = conn.prepareStatement("SELECT YIELD() FROM SYSTEM_RANGE(1, 100000000) LIMIT ?");
prep.setInt(1, 100000000); prep.setInt(1, 100000000);
Thread t = new Thread() { Thread t = new Thread() {
public void run() { public void run() {
...@@ -269,7 +269,7 @@ public class TestPreparedStatement extends TestBase { ...@@ -269,7 +269,7 @@ public class TestPreparedStatement extends TestBase {
} }
}; };
t.start(); t.start();
Thread.sleep(10); Thread.sleep(100);
try { try {
prep.cancel(); prep.cancel();
} catch (SQLException e) { } catch (SQLException e) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论