removed possible synchronization deadlock

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4511 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent 3f321ece7d
commit 253a453413

@ -1607,7 +1607,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
return hasDoneSomething; return hasDoneSomething;
} }
synchronized public boolean htEntryStoreProcess(plasmaHTCache.Entry entry) { public boolean htEntryStoreProcess(plasmaHTCache.Entry entry) {
if (entry == null) return false; if (entry == null) return false;
@ -1641,6 +1641,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
doIndexing = false; doIndexing = false;
} }
synchronized (sbQueue) {
/* ========================================================================= /* =========================================================================
* STORING DATA * STORING DATA
* *
@ -1648,10 +1649,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
* a) the user has configured to use the htcache or * a) the user has configured to use the htcache or
* b) the content should be indexed * b) the content should be indexed
* ========================================================================= */ * ========================================================================= */
if ( if ((entry.profile().storeHTCache()) || (doIndexing && isSupportedContent)) {
(entry.profile().storeHTCache()) ||
(doIndexing && isSupportedContent)
) {
// store response header // store response header
if (entry.writeResourceInfo()) { if (entry.writeResourceInfo()) {
this.log.logInfo("WROTE HEADER for " + entry.cacheFile()); this.log.logInfo("WROTE HEADER for " + entry.cacheFile());
@ -1697,6 +1695,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
plasmaHTCache.deleteURLfromCache(entry.url()); plasmaHTCache.deleteURLfromCache(entry.url());
} }
} }
}
return true; return true;
} }
@ -1808,6 +1807,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
checkInterruption(); checkInterruption();
// getting the next entry from the indexing queue // getting the next entry from the indexing queue
plasmaSwitchboardQueue.Entry nextentry = null;
synchronized (sbQueue) { synchronized (sbQueue) {
if (sbQueue.size() == 0) { if (sbQueue.size() == 0) {
@ -1820,8 +1820,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
return doneSomething; return doneSomething;
} }
plasmaSwitchboardQueue.Entry nextentry;
// if we were interrupted we should return now // if we were interrupted we should return now
if (Thread.currentThread().isInterrupted()) { if (Thread.currentThread().isInterrupted()) {
log.logFine("deQueue: thread was interrupted"); log.logFine("deQueue: thread was interrupted");
@ -1856,9 +1855,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
this.indexingTasksInProcess.put(nextentry.urlHash(), nextentry); this.indexingTasksInProcess.put(nextentry.urlHash(), nextentry);
} }
// parse and index the resource
processResourceStack(nextentry);
} }
// parse and index the resource
processResourceStack(nextentry);
return true; return true;
} catch (InterruptedException e) { } catch (InterruptedException e) {
log.logInfo("DEQUEUE: Shutdown detected."); log.logInfo("DEQUEUE: Shutdown detected.");

Loading…
Cancel
Save