public static ExecutorService createFixedTimeoutExecutorService ( int poolSize , long keepAliveTime , TimeUnit timeUnit ) { ThreadPoolExecutor e = new ThreadPoolExecutor ( poolSize , poolSize , keepAliveTime , timeUnit , new LinkedBlockingQueue < Runnable > ( ) ) ; e . allowCoreThreadTimeOut ( true ) ; return e ; }
Creates an executor service with a fixed pool size that will time out after a certain period of inactivity .