ExecutorService that interrupts tasks after a timeout
问题 I\'m looking for an ExecutorService implementation that can be provided with a timeout. Tasks that are submitted to the ExecutorService are interrupted if they take longer than the timeout to run. Implementing such a beast isn\'t such a difficult task, but I\'m wondering if anybody knows of an existing implementation. Here\'s what I came up with based on some of the discussion below. Any comments? import java.util.List; import java.util.concurrent.*; public class TimeoutThreadPoolExecutor