• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. Loom
  4. Getting started

Page History

Versions Compared

Old Version 30

changes.mady.by.user Alan Bateman

Saved on Jun 06, 2020

compared with

New Version 31

changes.mady.by.user Alan Bateman

Saved on Jun 29, 2020

  • Previous Change: Difference between versions 29 and 30
  • Next Change: Difference between versions 31 and 32
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This following example uses submitTasks to submit three value returning tasks. It uses the CompletableFuture.streamcompleted method to obtain a stream that is lazily populated as the tasks complete.

Code Block
languagejava
try (ExecutorService executor = Executors.newVirtualThreadExecutor()) {
    Callable<String> task1 = () -> "foo";
    Callable<String> task2 = () -> "bar";
    Callable<String> task3 = () -> "baz";
    List<CompletableFuture<String>> cfs = executor.submitTasks(List.of(task1, task2, task3));
    CompletableFuture.streamcomplete(cfs)
       .map(CompletableFuture::join)
       .forEach(System.out::println);
}

...

Overview
Content Tools
ThemeBuilder

Terms of Use • License: GPLv2 • Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Adaptavist ThemeBuilder Powered by Atlassian Confluence 7.4.1
  • Adaptavist ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Adaptavist ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 229, "requestCorrelationId": "73315bf88cadec33"}