code: public static void forkJoinExecution(Runnable runnable, ConcurrencyConfiguration concurrencyConfiguration, boolean parallelStream) {
          if(parallelStream && concurrencyConfiguration.isParallelized()) {
              try {
                  ForkJoinPool pool = new ForkJoinPool(concurrencyConfiguration.getMaxNumberOfThreadsPerTask());
                  pool.submit(runnable).get();
                  pool.shutdown();
              } 
              catch (InterruptedException | ExecutionException ex) {
                  throw new RuntimeException(ex);
              }
          }
          else {
              runnable.run();
          }
      }
docs: Alternative to parallelStreams() which executes a runnable in a separate
  pool.
  
  @param runnable
  @param concurrencyConfiguration
  @param parallelStream