You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/11/17 09:52:29 UTC

svn commit: r1640101 - in /manifoldcf/trunk/framework: core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java

Author: kwright
Date: Mon Nov 17 08:52:29 2014
New Revision: 1640101

URL: http://svn.apache.org/r1640101
Log:
Fix a bug with the new polling registration.

Modified:
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java?rev=1640101&r1=1640100&r2=1640101&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java Mon Nov 17 08:52:29 2014
@@ -265,6 +265,17 @@ public class ManifoldCF
             logConfigFile = new File(configPath,"logging.ini");
           }
 
+          // Make sure that the registered entry points for polling and cleanup are cleared, just in case.
+          // This prevents classloader-style registration, which is actually not a good one for MCF architecture.
+          synchronized (cleanupHooks)
+          {
+            cleanupHooks.clear();
+          }
+          synchronized (pollingHooks)
+          {
+            pollingHooks.clear();
+          }
+          
           Logging.initializeLoggingSystem(logConfigFile);
 
           // Set up local loggers
@@ -1449,9 +1460,12 @@ public class ManifoldCF
   public static void pollAll(IThreadContext threadContext)
     throws ManifoldCFException
   {
-    for (IPollingHook hook : pollingHooks)
+    synchronized (pollingHooks)
     {
-      hook.doPoll(threadContext);
+      for (IPollingHook hook : pollingHooks)
+      {
+        hook.doPoll(threadContext);
+      }
     }
   }
   
@@ -1508,6 +1522,10 @@ public class ManifoldCF
           }
           cleanupHooks.clear();
         }
+        synchronized (pollingHooks)
+        {
+          pollingHooks.clear();
+        }
         alreadyShutdown = true;
       }
     }

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java?rev=1640101&r1=1640100&r2=1640101&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java Mon Nov 17 08:52:29 2014
@@ -65,7 +65,8 @@ public class IdleCleanupThread extends T
         {
           // Do the cleanup
           repositoryConnectorPool.pollAllConnectors();
-          ManifoldCF.pollAll(threadContext);
+          // This is unnecessary because agents.interfaces.IdleCleanupThread does it.
+          //ManifoldCF.pollAll(threadContext);
           
           // Sleep for the retry interval.
           ManifoldCF.sleep(5000L);