public static MonitorableTaskExecutorService newStoppableExecutor(String name, int threadCount) {
ExceptionHelper.checkArgumentInRange(threadCount, 1, Integer.MAX_VALUE, "threadCount");
if (threadCount == 1) {
return new SingleThreadedExecutor(name, Integer.MAX_VALUE, IDLE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
}
else {
return new ThreadPoolTaskExecutor(name, threadCount, Integer.MAX_VALUE, IDLE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
}
}