所以,我很好奇。您如何处理设置线程的最大执行时间?在线程池中运行时?我有几种技巧,但我对它们总是不太满意。所以,我想我会问问社区他们是怎么做的。 最佳答案 怎么样:将您的Callable提交给ExecutorService并保留返回的Future的句柄。ExecutorServiceexecutorService=...//CreateExecutorService.Callablecallable=newMyCallable();//Createworktobedone.Futurefut=executorService.subm