提交 8ca7992f authored 作者: Noel Grandin's avatar Noel Grandin

try to fix CI

上级 fd3217c3
...@@ -389,7 +389,7 @@ public class TestMultiThread extends TestBase implements Runnable { ...@@ -389,7 +389,7 @@ public class TestMultiThread extends TestBase implements Runnable {
"CREATE TABLE IF NOT EXISTS TRAN (ID NUMBER(18,0) not null PRIMARY KEY)"); "CREATE TABLE IF NOT EXISTS TRAN (ID NUMBER(18,0) not null PRIMARY KEY)");
final int threadCount = 100; final int threadCount = 100;
final ArrayList<Callable<Integer>> callables = new ArrayList<Callable<Integer>>(); final ArrayList<Callable<Void>> callables = new ArrayList<Callable<Void>>();
for (int i = 0; i < threadCount; i++) { for (int i = 0; i < threadCount; i++) {
final Connection taskConn = getConnection(url); final Connection taskConn = getConnection(url);
taskConn.setAutoCommit(false); taskConn.setAutoCommit(false);
...@@ -397,9 +397,9 @@ public class TestMultiThread extends TestBase implements Runnable { ...@@ -397,9 +397,9 @@ public class TestMultiThread extends TestBase implements Runnable {
.prepareStatement("INSERT INTO tran (id) values(?)"); .prepareStatement("INSERT INTO tran (id) values(?)");
// to guarantee uniqueness // to guarantee uniqueness
final long initialTransactionId = i * 1000000L; final long initialTransactionId = i * 1000000L;
callables.add(new Callable<Integer>() { callables.add(new Callable<Void>() {
@Override @Override
public Integer call() throws Exception { public Void call() throws Exception {
long tranId = initialTransactionId; long tranId = initialTransactionId;
for (int j = 0; j < 10000; j++) { for (int j = 0; j < 10000; j++) {
insertTranStmt.setLong(1, tranId++); insertTranStmt.setLong(1, tranId++);
...@@ -407,7 +407,7 @@ public class TestMultiThread extends TestBase implements Runnable { ...@@ -407,7 +407,7 @@ public class TestMultiThread extends TestBase implements Runnable {
taskConn.commit(); taskConn.commit();
} }
taskConn.close(); taskConn.close();
return 1; return null;
} }
}); });
} }
...@@ -415,15 +415,13 @@ public class TestMultiThread extends TestBase implements Runnable { ...@@ -415,15 +415,13 @@ public class TestMultiThread extends TestBase implements Runnable {
final ExecutorService executor = Executors final ExecutorService executor = Executors
.newFixedThreadPool(threadCount); .newFixedThreadPool(threadCount);
try { try {
final ArrayList<Future<Integer>> jobs = new ArrayList<Future<Integer>>(); final ArrayList<Future<Void>> jobs = new ArrayList<Future<Void>>();
for (int i = 0; i < threadCount; i++) { for (int i = 0; i < threadCount; i++) {
jobs.add(executor.submit(callables.get(i))); jobs.add(executor.submit(callables.get(i)));
} }
// check for exceptions // check for exceptions
for (Future<Integer> job : jobs) { for (Future<Void> job : jobs) {
if (job.get(180, TimeUnit.SECONDS) == null) { job.get(5, TimeUnit.MINUTES);
throw new RuntimeException("timed out");
}
} }
} finally { } finally {
conn.close(); conn.close();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论