Examples of MyRecursiveTask


Examples of com.packtpub.java7.concurrency.chapter7.recipe06.task.MyRecursiveTask

    }
   
    /*
     * Create a new Task to sum the elements of the array
     */
    MyRecursiveTask task=new MyRecursiveTask(array,0,array.length);
   
    /*
     * Send the task to the ForkJoinPool
     */
    pool.execute(task);
   
   
    /*
     * Wait for the finalization of the task
     */
    task.join();
   
    /*
     * Shutdown the pool
     */
    pool.shutdown();
   
    /*
     * Wait for the finalization of the pool
     */
    pool.awaitTermination(1, TimeUnit.DAYS);
   
    /*
     * Write the result of the task
     */
    System.out.printf("Main: Result: %d\n",task.get());
   
    /*
     * Write a message indicating the end of the program
     */
    System.out.printf("Main: End of the program\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.