【CompetableFuture】Thread.currentThread().getName() 打印不出来

【CompetableFuture】Thread.currentThread().getName() 打印不出来,第1张

【CompetableFuture】Thread.currentThread().getName() 打印不出来

CompletableFuture.supplyAsync(()->{
System.out.println(“Some Result”);//打印出来了
System.out.println(“Some Result” +Thread.currentThread().getName());//打印不出来
return “Some Result”;
}).thenApplyAsync(result -> {

System.out.println("Processed Result " + Thread.currentThread().getName());//打印不出来
return “Processed Result”;
});

参考
https://www.callicoder.com/java-8-completablefuture-tutorial/#a-note-about-executor-and-thread-pool–
https://www.runoob.com/java/thread-name.html

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5722307.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-18
下一篇 2022-12-18

发表评论

登录后才能评论

评论列表(0条)

保存