| | |
| | | ); |
| | | |
| | | try { |
| | | log.info("\n================ 普通任务执行 ================"); |
| | | customthreadPoolExecutor.execute(() -> { |
| | | |
| | | |
| | |
| | | |
| | | TimeUnit.MILLISECONDS.sleep(1); |
| | | |
| | | log.info("\n================ 带返回值的任务执行 ================"); |
| | | Future<String> future = customthreadPoolExecutor.submit(() -> { |
| | | log.info("线程:{},办理业务", Thread.currentThread().getName()); |
| | | return "业务办理完成"; |
| | | }); |
| | | log.info(future.get()); |
| | | // Future<String> future = customthreadPoolExecutor.submit(() -> { |
| | | // log.info("线程:{},办理业务", Thread.currentThread().getName()); |
| | | // return "业务办理完成"; |
| | | // }); |
| | | // log.info(future.get()); |
| | | } finally { |
| | | gracefulShutdown(customthreadPoolExecutor); |
| | | } |