Skip to content

Commit

Permalink
Improve virtual thread test
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Oct 17, 2024
1 parent 793bdfe commit ff050ee
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,25 @@ public void start() {
@Test
public void testExecuteBlocking() {
Assume.assumeTrue(isVirtualThreadAvailable());
Promise<Void> p = Promise.promise();
vertx.deployVerticle(new AbstractVerticle() {
@Override
public void start() {
Future<String> fut = vertx.executeBlocking(() -> {
assertTrue(isVirtual(Thread.currentThread()));
return Thread.currentThread().getName();
});
String res = fut.await();
String res;
try {
res = fut.await();
} catch (Exception e) {
p.fail(e);
return;
}
assertNotSame(Thread.currentThread().getName(), res);
testComplete();
p.complete();
}
}, new DeploymentOptions().setThreadingModel(ThreadingModel.VIRTUAL_THREAD));
await();
}, new DeploymentOptions().setThreadingModel(ThreadingModel.VIRTUAL_THREAD)).await();
}

@Test
Expand Down

0 comments on commit ff050ee

Please sign in to comment.