some refactor

pull/88/head^2
yihua.huang 11 years ago
parent 84976c81ec
commit 1446ada732

@ -252,15 +252,7 @@ public class Spider implements Runnable, Task {
break;
}
// wait until new url added
try {
newUrlLock.lock();
try {
newUrlCondition.await();
} catch (InterruptedException e) {
}
} finally {
newUrlLock.unlock();
}
waitNewUrl();
} else {
final Request requestFinal = request;
threadAlive.incrementAndGet();
@ -398,6 +390,18 @@ public class Spider implements Runnable, Task {
return this;
}
private void waitNewUrl() {
try {
newUrlLock.lock();
try {
newUrlCondition.await();
} catch (InterruptedException e) {
}
} finally {
newUrlLock.unlock();
}
}
private void signalNewUrl() {
try {
newUrlLock.lock();

Loading…
Cancel
Save