Skip to content

Commit cc08fa4

Browse files
authored
Update README.md
1 parent e12f46f commit cc08fa4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ class Test {
3939
// The main thread executes CompletableFuture tasks, avoiding the use of ForkJoinPool
4040
public void usingCompletableFuture() {
4141
CurrentThreadExecutor executor = new CurrentThreadExecutor();
42-
CompletableFuture<String> voidCompletableFuture = CompletableFuture.supplyAsync(() -> "Hello " + Thread.currentThread().getName(), executor);
42+
CompletableFuture<String> voidCompletableFuture = CompletableFuture.supplyAsync(() -> {
43+
// main thread
44+
return "Hello " + Thread.currentThread().getName();
45+
}, executor);
4346
String hello = executor.start(voidCompletableFuture);
4447
System.out.println(hello); // Hello main
4548
}

0 commit comments

Comments
 (0)