1 31 package org.objectweb.proactive.core.group.threadpool; 32 33 34 39 public class EndControler { 40 41 42 private int numberOfAwakeThreads = 0; 43 44 48 private boolean started = false; 49 50 51 synchronized public void waitDone() { 52 try { 53 while (this.numberOfAwakeThreads > 0) { 54 this.wait(); 55 } 56 } 57 catch (InterruptedException e) { System.err.println("InterruptedException"); } 58 } 59 60 72 73 synchronized public void jobStart() { 74 this.numberOfAwakeThreads++; 76 this.started = true; 77 this.notify(); 78 } 79 80 81 synchronized public void jobFinish() { 82 this.numberOfAwakeThreads--; 84 this.notify(); 85 } 86 87 88 synchronized public void reset() { 89 this.numberOfAwakeThreads = 0; 90 } 91 92 } 93 | Popular Tags |