Examples of ForkJoinPool


Examples of akka.jsr166y.ForkJoinPool

public class JavaFuturesAnalysisEngine extends SequentialAnalysisEngine {

    private ExecutorService executor;

    public JavaFuturesAnalysisEngine() {
        this.executor = new ForkJoinPool();
    }
View Full Code Here

Examples of akka.jsr166y.ForkJoinPool

public class GuavaListenableFuturesAnalysisEngine extends SequentialAnalysisEngine {

    private ListeningExecutorService executor;

    public GuavaListenableFuturesAnalysisEngine() {
        this.executor = MoreExecutors.listeningDecorator(new ForkJoinPool());
    }
View Full Code Here

Examples of io.netty.util.internal.chmv8.ForkJoinPool

    @Override
    public Executor newExecutor(int parallelism) {
        ForkJoinWorkerThreadFactory threadFactory =
                new DefaultForkJoinWorkerThreadFactory(namePrefix + '-' + executorId.getAndIncrement());

        return new ForkJoinPool(parallelism, threadFactory, DefaultUncaughtExceptionHandler.INSTANCE, true);
    }
View Full Code Here

Examples of java.util.concurrent.ForkJoinPool

    this.asyncMode = asyncMode;
  }

  public void afterPropertiesSet() {
    this.forkJoinPool =
        new ForkJoinPool(this.parallelism, this.threadFactory, this.uncaughtExceptionHandler, this.asyncMode);
  }
View Full Code Here

Examples of java.util.concurrent.ForkJoinPool

    /**
     * Creates a {@code MergeSort} containing a ForkJoinPool with the indicated parallelism level
     * @param parallelism the parallelism level used
     */
    public MergeSort(int parallelism) {
        pool = new ForkJoinPool(parallelism);
    }
View Full Code Here

Examples of java.util.concurrent.ForkJoinPool

   * @throws InterruptedException
   * @throws ExecutionException
   */
  public static void main(String[] args) throws InterruptedException, ExecutionException {
   
    ForkJoinPool pool = new ForkJoinPool();
    Task executionTask = new Task(1000000000.0);
    pool.invoke(executionTask);
    System.out.println(pool.toString());
    System.out.println(String.format("Full execution time is %d", executionTask.get()));
    pool.shutdown();
  }
View Full Code Here

Examples of java.util.concurrent.ForkJoinPool

   
    // Create a TaskManager object
    TaskManager manager=new TaskManager();
   
    // Create a ForkJoinPool with the default constructor
    ForkJoinPool pool=new ForkJoinPool();
   
    // Create a Task to process the array
    SearchNumberTask task=new SearchNumberTask(array,0,1000,5,manager);
   
    // Execute the task
    pool.execute(task);

    // Shutdown the pool
    pool.shutdown();
   
   
    // Wait for the finalization of the task
    try {
      pool.awaitTermination(1, TimeUnit.DAYS);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
   
    // Write a message to indicate the end of the program
View Full Code Here

Examples of java.util.concurrent.ForkJoinPool

    }
    end=new Date();
    System.out.printf("Main: Executor: %d\n",(end.getTime()-start.getTime()));
   
    TaskFJ taskFJ=new TaskFJ(array,1,100000);
    ForkJoinPool pool=new ForkJoinPool();
    start=new Date();
    pool.execute(taskFJ);
    pool.shutdown();
    try {
      pool.awaitTermination(1, TimeUnit.DAYS);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    end=new Date();
    System.out.printf("Core: Fork/Join: %d\n",(end.getTime()-start.getTime()));
View Full Code Here

Examples of java.util.concurrent.ForkJoinPool

   
    // Craete a task
    Task task=new Task(products, 0, products.size(), 0.20);
   
    // Create a ForkJoinPool
    ForkJoinPool pool=new ForkJoinPool();
   
    // Execute the Task
    pool.execute(task);

    // Write information about the pool
    do {
      System.out.printf("Main: Thread Count: %d\n",pool.getActiveThreadCount());
      System.out.printf("Main: Thread Steal: %d\n",pool.getStealCount());
      System.out.printf("Main: Paralelism: %d\n",pool.getParallelism());
      try {
        TimeUnit.MILLISECONDS.sleep(5);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    } while (!task.isDone());
 
    // Shutdown the pool
    pool.shutdown();
   
    // Check if the task has completed normally
    if (task.isCompletedNormally()){
      System.out.printf("Main: The process has completed normally.\n");
    }
View Full Code Here

Examples of java.util.concurrent.ForkJoinPool

    // Creates a new Handler
    Handler handler = new Handler();
    // Creates a Factory
    AlwaysThrowsExceptionWorkerThreadFactory factory=new AlwaysThrowsExceptionWorkerThreadFactory();
    // Creates a new ForkJoinPool
    ForkJoinPool pool=new ForkJoinPool(2,factory,handler,false);
   
    // Execute the task in the pool
    pool.execute(task);
 
    // Shutdown the pool
    pool.shutdown();
   
    // Wait for the finalization of the tasks
    try {
      pool.awaitTermination(1, TimeUnit.DAYS);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
   
    System.out.printf("Main: The program has finished.\n");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.