是否有使用当前线程的ExecutorService?
我所追求的是一种配置线程池使用的兼容方式。理想情况下,其余代码不应受到影响。我可以使用一个线程池与1个线程,但这不是我想要的。有任何想法吗?
ExecutorService es = threads == 0 ? new CurrentThreadExecutor() : Executors.newThreadPoolExecutor(threads);// es.execute / es.submit / new ExecutorCompletionService(es) etc
月关宝盒
相关分类