run的代码:
public void run() {
try {
if (pause) {
synchronized (this) {
wait();
}
}
//thread sleep every 0.25 sencond, so will not excute more than 4 links within 1 second
Thread.sleep(250);
if (isrun) {
getGoodLinks((String) crawledUrls.get(i));
}
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("----thread interrupted----");
}
}
唤醒的代码
pause = false;
synchronized (sa) { //
sa.notifyAll();
}
百思不得其解,之前还可以唤醒的....
public void run() {
try {
if (pause) {
synchronized (this) {
wait();
}
}
//thread sleep every 0.25 sencond, so will not excute more than 4 links within 1 second
Thread.sleep(250);
if (isrun) {
getGoodLinks((String) crawledUrls.get(i));
}
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("----thread interrupted----");
}
}
唤醒的代码
pause = false;
synchronized (sa) { //
sa.notifyAll();
}
百思不得其解,之前还可以唤醒的....
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货