multithreading - Does completableFuture in Java 8 scale to multiple cores? -


lets have single thread calls bunch of methods return completablefuture , add of them list , in end completablefutures.allof(list_size).join()). futures in list can scale multiple cores? other words futures scheduled multiple cores take advantage of parallelism?

completablefuture represents task associated executor. if did not specify executor explicitly (for example, used completablefuture.supplyasync(supplier) instead of completablefuture.supplyasync(supplier, executor)), common forkjoinpool used executor. pool obtained via forkjoinpool.commonpool() , default creates many threads many hardware threads system has (usually number of cores, double if cores support hyperthreading). in general, yes, if use defaults, multiple cores used completable futures.


Popular posts from this blog

Apache NiFi ExecuteScript: Groovy script to replace Json values via a mapping file -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -