P E N C I L
Login
Java parallel
Reference
Differnt ways
  1. Thread
    1. new Thread(new Runnable).start)
  2. Executor
    1. ExecutorService executor = Executors.newSingleThreadExecutor(); /  newCachedThreadPool)
      executer.submit(runnable)
      executer.submit(Callable) => Future<T>
    2. future.get(1,SECONDS) => timeout
    3. executer.invokeAll(List<Runable>)) => list of stream
  1. Stream
    List.stream().parallel().
    It use. ForkJoinPool.common(), which is Executors.newWorkStealthThreadExecutor()
  2. CompletableFuture
    1. http://www.baeldung.com/java-completablefuture
    2. CompletableFuture.supplyAsync().thenApplyAsync().thenAcceptAsync().thenCompose().thenCombine()
    3. CompletableFuture.allOf()
    4. CompletableFuture.get(),  join() not throw exeception