I have a silly problem, I need an ExecutorService (and ForkJoinPool is such a thing) but I don't really want to initialise a new one and keep that reference, I remember a while back running into a JDK class that maintained an static ForkJoinPool for various uses and that could be used by other processes, but I can't seem to find it and there is not that much info about such a thing online. Does any know if such a thing exists ?
问问题
158 次
1 回答
0
ForkJoinPool.commonPool()
是单个静态实例
您可以使用Executors.newWorkStealingPool
来获取工作窃取池(ForkJoinPool.defaultForkJoinWorkerThreadFactory
在后台使用),但这需要您存储池引用。
因此,这两个都将是每个 JVM(每个进程),而不是您所说的跨进程,我不知道您可以使用哪个池来做到这一点。
于 2015-08-21T09:46:56.947 回答