
多线程
嘿丶小伙计
http://my.youkuaiyun.com/my/favorite
展开
-
异步调用不同方法,哪个方法先返回,则直接返回其结果
public static void main(String[] args) throws ExecutionException, InterruptedException { System.out.println("----程序开始运行----"); int taskSize = 2; // 创建一个线程池 ExecutorService pool = Executors.newFixedThreadPool(taskSize); .原创 2021-08-20 17:01:14 · 371 阅读 · 0 评论 -
Java子线程抛异常传递到主线程
public static void main(String[] args) { try { AtomicLong count = new AtomicLong(0); Thread th = Thread.currentThread(); BusinessRuntimeException err =...原创 2019-09-20 14:46:31 · 2897 阅读 · 0 评论