Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created June 30, 2020 21:22
Show Gist options
  • Select an option

  • Save theboreddev/9329afb555257d79a4df01775f64e0f7 to your computer and use it in GitHub Desktop.

Select an option

Save theboreddev/9329afb555257d79a4df01775f64e0f7 to your computer and use it in GitHub Desktop.
threads
Runnable task = () -> {
System.out.println("Async task thread : " + Thread.currentThread().getName());
System.out.println("EXECUTED!");
};
final CompletableFuture<Void> future = CompletableFuture.runAsync(task);
System.out.println("Main thread : " + Thread.currentThread().getName());
future.join();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment