orbiter 19 years ago
parent 81fc50978c
commit 7dbcd358b4

@ -189,12 +189,14 @@ public final class plasmaCrawlStacker {
checkInterruption(); checkInterruption();
stackCrawlMessage theMsg = this.queue.waitForMessage(); stackCrawlMessage theMsg = this.queue.waitForMessage();
// getting a free session thread from the pool if (theMsg != null) {
checkInterruption(); // getting a free session thread from the pool
Worker worker = (Worker) this.theWorkerPool.borrowObject(); checkInterruption();
Worker worker = (Worker) this.theWorkerPool.borrowObject();
// processing the new request // processing the new request
worker.execute(theMsg); worker.execute(theMsg);
}
} catch (Exception e) { } catch (Exception e) {
if (e instanceof InterruptedException) { if (e instanceof InterruptedException) {
this.log.logFine("Interruption detected."); this.log.logFine("Interruption detected.");
@ -768,9 +770,9 @@ public final class plasmaCrawlStacker {
this.readSync.P(); this.readSync.P();
this.writeSync.P(); this.writeSync.P();
if (this.urlEntryHashCache.size() == 0) return null;
String urlHash = null; String urlHash = null;
kelondroRow.Entry entry = null; kelondroRow.Entry entry = null;
stackCrawlMessage newMessage = null;
try { try {
synchronized(this.urlEntryHashCache) { synchronized(this.urlEntryHashCache) {
urlHash = (String) this.urlEntryHashCache.removeFirst(); urlHash = (String) this.urlEntryHashCache.removeFirst();
@ -781,8 +783,8 @@ public final class plasmaCrawlStacker {
this.writeSync.V(); this.writeSync.V();
} }
newMessage = new stackCrawlMessage(urlHash, entry); if ((urlHash == null) || (entry == null)) return null;
return newMessage; return new stackCrawlMessage(urlHash, entry);
} }
} }

Loading…
Cancel
Save