public static ExecutorService newThreadPool(BlockingQueue<Runnable> workQueue, String prefix, int threadCount,
boolean watch) {
BlurThreadPoolExecutor executorService = new BlurThreadPoolExecutor(threadCount, threadCount, 60L,
TimeUnit.SECONDS, workQueue, new BlurThreadFactory(prefix));
executorService.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executorService.add(new UserThreadBoundaryProcessor());
if (watch) {
return Trace.getExecutorService(ThreadWatcher.instance().watch(executorService));
}
return Trace.getExecutorService(executorService);
}