Package java.util.concurrent

Examples of java.util.concurrent.ForkJoinPool.shutdown()


    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();
  }

  private static class Task extends RecursiveTask<Long> {
    private static final long serialVersionUID = 1L;
    private static final int THRESHOLD = 10000;
View Full Code Here


   
    // Execute the task
    pool.execute(task);

    // Shutdown the pool
    pool.shutdown();
   
   
    // Wait for the finalization of the task
    try {
      pool.awaitTermination(1, TimeUnit.DAYS);
View Full Code Here

   
    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();
    }
View Full Code Here

        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

   
    // 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) {
View Full Code Here

    }
   
    /*
     * Shutdown the pool
     */
    pool.shutdown();
   
    /*
     * Wait for the finalization of the pool
     */
    pool.awaitTermination(1, TimeUnit.DAYS);
View Full Code Here

      }
     
    } while (!task.isDone());

    // Shutdown the pool
    pool.shutdown();
   
    // Wait for the finalization of the tasks
    try {
      pool.awaitTermination(1, TimeUnit.DAYS);
    } catch (InterruptedException e) {
View Full Code Here

   
    // Execute the task
    pool.execute(task);
 
    // Shutdown the ForkJoinPool
    pool.shutdown();
   
    // Wait for the finalization of the task
    try {
      pool.awaitTermination(1, TimeUnit.DAYS);
    } catch (InterruptedException e) {
View Full Code Here

    pool.invoke(task);
   
    /*
     * Shutdown the pool
     */
    pool.shutdown();
   
    /*
     * Write a message in the console
     */
    System.out.printf("Main: End of the program.\n");
View Full Code Here

        e.printStackTrace();
      }
    } while ((!system.isDone())||(!apps.isDone())||(!documents.isDone()));
   
    // Shutdown the pool
    pool.shutdown();
   
    // Write the number of results calculate by each task
    List<String> results;
   
    results=system.join();
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.