Skip to content

Commit d7978d6

Browse files
authored
Merge pull request #2831 from hogimn/test
Use CountDownLatch to coordinate the execution order
2 parents 41afa7d + c6f6504 commit d7978d6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/test/java/org/apache/ibatis/datasource/pooled/PooledDataSourceTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,19 @@ void shouldBlockUntilConnectionIsAvailableInPooledDataSource() throws Exception
6767
@Test
6868
void PoppedConnectionShouldBeNotEqualToClosedConnection() throws Exception {
6969
Connection connectionToClose = dataSource.getConnection();
70+
CountDownLatch latch = new CountDownLatch(1);
7071

7172
new Thread(() -> {
7273
try {
74+
latch.await();
7375
assertNotEquals(connectionToClose, dataSource.getConnection());
7476
} catch (Exception e) {
7577
throw new RuntimeException(e);
7678
}
7779
}).start();
7880

7981
connectionToClose.close();
82+
latch.countDown();
8083
}
8184

8285
@Test

0 commit comments

Comments
 (0)