Examples of ResultTask


Examples of com.packtpub.java7.concurrency.chapter4.recipe10.task.ResultTask

  public static void main(String[] args) {
    // Create an executor
    ExecutorService executor=(ExecutorService)Executors.newCachedThreadPool();
   
    //Create five tasks
    ResultTask resultTasks[]=new ResultTask[5];
    for (int i=0; i<5; i++) {
      ExecutableTask executableTask=new ExecutableTask("Task "+i);
      resultTasks[i]=new ResultTask(executableTask);
      executor.submit(resultTasks[i]);
    }
   
    // Sleep the thread five seconds
    try {
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.