From 7dbcd358b4dfe54ca3928df0af217daf6f0d0e1d Mon Sep 17 00:00:00 2001 From: orbiter Date: Wed, 29 Nov 2006 23:09:56 +0000 Subject: [PATCH] fix for http://www.yacy-forum.de/viewtopic.php?p=28231#28231 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3021 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- .../de/anomic/plasma/plasmaCrawlStacker.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/source/de/anomic/plasma/plasmaCrawlStacker.java b/source/de/anomic/plasma/plasmaCrawlStacker.java index c91e1972a..888df3367 100644 --- a/source/de/anomic/plasma/plasmaCrawlStacker.java +++ b/source/de/anomic/plasma/plasmaCrawlStacker.java @@ -189,12 +189,14 @@ public final class plasmaCrawlStacker { checkInterruption(); stackCrawlMessage theMsg = this.queue.waitForMessage(); - // getting a free session thread from the pool - checkInterruption(); - Worker worker = (Worker) this.theWorkerPool.borrowObject(); - - // processing the new request - worker.execute(theMsg); + if (theMsg != null) { + // getting a free session thread from the pool + checkInterruption(); + Worker worker = (Worker) this.theWorkerPool.borrowObject(); + + // processing the new request + worker.execute(theMsg); + } } catch (Exception e) { if (e instanceof InterruptedException) { this.log.logFine("Interruption detected."); @@ -768,9 +770,9 @@ public final class plasmaCrawlStacker { this.readSync.P(); this.writeSync.P(); + if (this.urlEntryHashCache.size() == 0) return null; String urlHash = null; kelondroRow.Entry entry = null; - stackCrawlMessage newMessage = null; try { synchronized(this.urlEntryHashCache) { urlHash = (String) this.urlEntryHashCache.removeFirst(); @@ -781,8 +783,8 @@ public final class plasmaCrawlStacker { this.writeSync.V(); } - newMessage = new stackCrawlMessage(urlHash, entry); - return newMessage; + if ((urlHash == null) || (entry == null)) return null; + return new stackCrawlMessage(urlHash, entry); } }