About 50 results
Open links in new tab
  1. java - ExecutorService vs CompletableFuture - Stack Overflow

    Sep 13, 2018 · CompletableFuture.supplyAsync(() -> MyFileService.service3(); } I understand that that CompletableFuture is new from Java 8, but how is the 2nd code better than the 1st? Since, for …

  2. Transform Java Future into a CompletableFuture - Stack Overflow

    Apr 26, 2014 · Java 8 introduces CompletableFuture, a new implementation of Future that is composable (includes a bunch of thenXxx methods). I'd like to use this exclusively, but many of the …

  3. CompletableFuture<T> class: join () vs get () - Stack Overflow

    The part about exceptionally() is a bit distracting because it isn't relevant, as exceptionally(…) can be used with either get() or with join(). Perhaps you were trying to add additional commentary that …

  4. java - CompletableFuture: several tasks - Stack Overflow

    Apr 15, 2018 · The default executor of CompletableFuture is the common pool of the ForkJoinPool, which has a default target parallelism matching the number of CPU cores minus one. So if you have …

  5. Spring @Async with CompletableFuture - Stack Overflow

    CompletableFuture<User> future = CompletableFuture.runAsync(() -> doFoo(), myExecutor); And all of your exceptionally logic you would do with the returned CompletableFuture from that method.

  6. java - Return CompletableFuture<Void> or ... - Stack Overflow

    Dec 12, 2015 · For example: CompletableFuture.allOf, the passed list might be a CompletableFuture originated from a Runnable, so we can't get the result. Having said all of that, …

  7. CompletableFuture, supplyAsync () and thenApply () - Stack Overflow

    CompletableFuture .supplyAsync(() -> { A a = doSomethingAndReturnA(); convertToB(a); }); Right? Furthermore, another two questions following as for "is there any reason why we would use …

  8. java - What is the correct way to create an already-completed ...

    Oct 9, 2017 · Returns a new CompletableFuture that is already completed with the given value. and Void is uninstantiable, so I need another way to create an already-completed future of type …

  9. spring - Thread vs Runnable vs CompletableFuture in Java multi ...

    Jan 5, 2023 · As far as I see, I can use Thread, Runnable or CompletableFuture in order to implement multi threading in a Java app. CompletableFuture seems a newer and cleaner way, but Thread may …

  10. java - Return a CompletableFuture containing a list of ...

    Nov 29, 2019 · By the way, the equivalent of flatMap for completableFuture is thenCompose() which takes a function that takes the element returned by the Future as an input and must returns another …