@Test
public void test() throws ExecutionException, InterruptedException {
Callable<String> callable = () -> "callable executed";
ThreadPoolExecutor executor = new ThreadPoolExecutor(3, 10, 5, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
Future<String> submit = executor.submit(callable);
System.out.println(submit.get());
}
// 执行结果
callable executed
上述代码的执行大致过程