excute
excute方法和submit方法
区别: 1.参数 execute Runnable submit Callable 2.返回值 execute :void submit :Future 3.异常 execute 会在子线程中抛出异常,在主线程捕捉不到 submit 不会字码抛出异常, 而是会讲一次暂时存起来,等Future.get ......
线程池excute方法执行流程
1 // 线程池execute方法执行流程 2 public void execute(Runnable command) { 3 // 非空判断,判断提交的任务是否为空 4 if (command == null) 5 throw new NullPointerException(); 6 // ......