关于多线程wait()和notify的用法
public class QualityTest{for(......){
taskExecutor.execute(new RunQualityTestTask(.....)) }
synchronized(runQualityTestTask.condition){
while(count != runQualityTestTask.matcount){
try {
condition.wait();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return msgJo;
}
public class RunQualityTestTask implements Runnable{
public Object condition ;
public static int matcount ;
public void run()
case1:
result = this.checkDefault1()//
matcount++ //
synchronized(condition) {
condition.notify();
}
case2:
result = this.checkDefault2()//
synchronized(condition) {
condition.notify();
}
.........
}
请教高手,这段代码在循环中开多个线程每个线程执行完后会在最后进行统计等到统计完以后满足主线程的条件后才能return,现在我在执行完第一个线程后,想唤醒主方法中的wait();没有任何反映也没有返回值? 多线程高手进来 --------------------编程问答-------------------- 还没人来!自己顶!
补充:Java , Java相关