• 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 29

changes.mady.by.user Alan Bateman

Saved on May 06, 2020

compared with

New Version 30

changes.mady.by.user Alan Bateman

Saved on Jun 06, 2020

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

Key

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

...

Code Block
languagejava
try (ExecutorService executor = Executors.newUnboundedVirtualThreadExecutornewVirtualThreadExecutor()) {
    executor.execute(() -> System.out.println("Hello"));
    executor.execute(() -> System.out.println("Hi"));
}

...

Code Block
languagejava
try (ExecutorService executor = Executors.newUnboundedVirtualThreadExecutornewVirtualThreadExecutor()) {
    Callable<String> task1 = () -> "foo";
    Callable<String> task2 = () -> "bar";
    Callable<String> task3 = () -> "baz";
    String result = executor.invokeAny(List.of(task1, task2, task3));
}

...

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

...

Code Block
languagejava
Instant deadline = Instant.now().plusSeconds(30);
try (ExecutorService executor = Executors.newUnboundedVirtualThreadExecutornewVirtualThreadExecutor().withDeadline(deadline)) {
    :
}

...

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": 272, "requestCorrelationId": "8aa6ec42dbc10c82"}