@Slf4j
class DeadLock2 {
public static void main(String[] args) {
ExecutorService pool = Executors.newFixedThreadPool(10);
pool.submit(() -> {
try{
log.info("First");
pool.submit(() -> log.info("second")).get();
log.info("third");
}catch (InterruptedException | ExecutionException e){
log.error("Error",e);
}
});
}
执行的结果如下: