Skip to content

Commit 83477b6

Browse files
committed
fixed tests that failed for http_client from jdk
1 parent 53916f7 commit 83477b6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clickhouse-jdbc/src/test/java/com/clickhouse/jdbc/ClickHouseStatementTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.File;
44
import java.io.IOException;
5+
import java.lang.ref.WeakReference;
56
import java.math.BigDecimal;
67
import java.sql.Array;
78
import java.sql.BatchUpdateException;
@@ -1408,14 +1409,13 @@ public void testMultiThreadedExecution() throws Exception {
14081409

14091410
ScheduledExecutorService executor = Executors.newScheduledThreadPool(3);
14101411

1411-
final AtomicBoolean failed = new AtomicBoolean(false);
1412+
final WeakReference<Exception> failedException = new WeakReference<>(null);
14121413
for (int i = 0; i < 3; i++) {
14131414
executor.scheduleWithFixedDelay(() -> {
14141415
try {
14151416
stmt.execute("select 1");
14161417
} catch (Exception e) {
1417-
e.printStackTrace();
1418-
failed.set(true);
1418+
failedException.refersTo(e);
14191419
}
14201420
}, 100, 100, TimeUnit.MILLISECONDS);
14211421
}
@@ -1429,7 +1429,7 @@ public void testMultiThreadedExecution() throws Exception {
14291429
executor.shutdown();
14301430
executor.awaitTermination(10, TimeUnit.SECONDS);
14311431

1432-
Assert.assertFalse(failed.get());
1432+
Assert.assertNull(failedException.get(), "Failed because of exception: " + failedException.get());
14331433
}
14341434
}
14351435
}

0 commit comments

Comments
 (0)