Author: orbiter
Date: 2008-02-26 15:05:43 +0100 (Tue, 26 Feb 2008)
New Revision: 4511

Modified:
   trunk/source/de/anomic/plasma/plasmaSwitchboard.java
Log:
removed possible synchronization deadlock

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

_______________________________________________
YaCy-svn mailing list
YaCy-svn@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/yacy-svn

Antwort per Email an