Examples of Calculator


Examples of thread.concurrencyCookbook.chapter1.recipe1.task.Calculator

   */
  public static void main(String[] args) {

    //Launch 10 threads that make the operation with a different number
    for (int i=1; i<=10; i++){
      Calculator calculator=new Calculator(i);
      Thread thread=new Thread(calculator);
      thread.start();
    }
  }
View Full Code Here

Examples of thread.concurrencyCookbook.chapter1.recipe2.task.Calculator

    // Launch 10 threads to do the operation, 5 with the max
    // priority, 5 with the min
    threads=new Thread[10];
    status=new Thread.State[10];
    for (int i=0; i<10; i++){
      threads[i]=new Thread(new Calculator(i));
      if ((i%2)==0){
        threads[i].setPriority(Thread.MAX_PRIORITY);
      } else {
        threads[i].setPriority(Thread.MIN_PRIORITY);
      }
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.