ForkJoinPool forkJoinPool = new ForkJoinPool(2);
forkJoinPool.submit(() ->
//parallel task here, for example
IntStream.range(1, 1_000_000).parallel().filter(PrimesPrint::isPrime).collect(toList())
).get();
Reactive streams are a unified way of dealing with asynchronous events in JavaScript. Learn more in this tutorial with RxJs examples that you can run & modify.