package cn.how2j.springcloud; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class TestXianCheng { public static void main(String[] args) { int a = 0; System.out.println(ThreadLocalRandom.current().nextInt()); //ExecutorService executorService = ThreadPoolExecutor executorService = new ThreadPoolExecutor(2, 5, 5L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); executorService.submit(() -> { System.out.println(add(a)); } ); } public static int add(int a) { return a+1000; } }