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

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo