combine two try-catch block into one, make it cleaner.

master
Bo LIANG 2014-04-16 16:05:08 +08:00
parent c8014a9ae6
commit 163773af6b
1 changed files with 6 additions and 6 deletions

View File

@ -489,17 +489,17 @@ public class Spider implements Runnable, Task {
} }
private void waitNewUrl() { private void waitNewUrl() {
newUrlLock.lock();
try { try {
newUrlLock.lock();
//double check //double check
if (threadAlive.get() == 0 && exitWhenComplete) { if (threadAlive.get() == 0 && exitWhenComplete) {
return; return;
} }
try { newUrlCondition.await();
newUrlCondition.await(); } catch (InterruptedException e) {
} catch (InterruptedException e) { logger.warn("waitNewUrl - interrupted, error {}", e);
} }
} finally { finally {
newUrlLock.unlock(); newUrlLock.unlock();
} }
} }