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/10/09 19:20:17 UTC

svn commit: r1630535 - in /manifoldcf/trunk: CHANGES.txt framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java

Author: kwright
Date: Thu Oct  9 17:20:17 2014
New Revision: 1630535

URL: http://svn.apache.org/r1630535
Log:
Fix for CONNECTORS-1070.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1630535&r1=1630534&r2=1630535&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Thu Oct  9 17:20:17 2014
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 2.0-dev =====================
 
+CONNECTORS-1070: Exit immediately upon finding a misconfigured
+ManifoldCF.
+(Kamil Żyta, Karl Wright)
+
 CONNECTORS-1067: Allow document filtering on modification date,
 and also hook this up in all repository connectors where it makes sense.
 (Karl Wright)

Modified: manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java?rev=1630535&r1=1630534&r2=1630535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java (original)
+++ manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java Thu Oct  9 17:20:17 2014
@@ -217,6 +217,12 @@ public class AgentsDaemon
           {
             if (e.getErrorCode() == ManifoldCFException.INTERRUPTED)
               break;
+            if (e.getErrorCode() == ManifoldCFException.SETUP_ERROR)
+            {
+              System.err.println("Misconfigured ManifoldCF agents - shutting down");
+              Logging.agents.fatal("AgentThread configuration exception tossed: "+e.getMessage(),e);
+              System.exit(-200);
+            }
             Logging.agents.error("Exception tossed: "+e.getMessage(),e);
           }
           catch (OutOfMemoryError e)
@@ -263,11 +269,11 @@ public class AgentsDaemon
         {
           // Start this agent
           IAgent agent = AgentFactory.make(className);
+          String serviceType = getAgentsClassServiceType(className);
           agent.initialize(threadContext);
           try
           {
             // Throw a lock, so that cleanup processes and startup processes don't collide.
-            String serviceType = getAgentsClassServiceType(className);
             lockManager.registerServiceBeginServiceActivity(serviceType, processID, new CleanupAgent(threadContext, agent, processID));
             // There is a potential race condition where the agent has been started but hasn't yet appeared in runningHash.
             // But having runningHash be the synchronizer for this activity will prevent any problems.
@@ -278,7 +284,10 @@ public class AgentsDaemon
           catch (ManifoldCFException e)
           {
             if (e.getErrorCode() != ManifoldCFException.INTERRUPTED)
+            {
               agent.cleanUp(threadContext);
+              lockManager.endServiceActivity(serviceType, processID);
+            }
             throw e;
           }
         }

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java?rev=1630535&r1=1630534&r2=1630535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java Thu Oct  9 17:20:17 2014
@@ -341,22 +341,22 @@ public class CrawlerAgent implements IAg
     // Now, start all the threads
     numWorkerThreads = ManifoldCF.getMaxWorkerThreads(threadContext);
     if (numWorkerThreads < 1 || numWorkerThreads > 300)
-      throw new ManifoldCFException("Illegal value for the number of worker threads");
+      throw new ManifoldCFException("Illegal value for the number of worker threads", ManifoldCFException.SETUP_ERROR);
     numDeleteThreads = ManifoldCF.getMaxDeleteThreads(threadContext);
     numCleanupThreads = ManifoldCF.getMaxCleanupThreads(threadContext);
     numExpireThreads = ManifoldCF.getMaxExpireThreads(threadContext);
     if (numDeleteThreads < 1 || numDeleteThreads > 300)
-      throw new ManifoldCFException("Illegal value for the number of delete threads");
+      throw new ManifoldCFException("Illegal value for the number of delete threads", ManifoldCFException.SETUP_ERROR);
     if (numCleanupThreads < 1 || numCleanupThreads > 300)
-      throw new ManifoldCFException("Illegal value for the number of cleanup threads");
+      throw new ManifoldCFException("Illegal value for the number of cleanup threads", ManifoldCFException.SETUP_ERROR);
     if (numExpireThreads < 1 || numExpireThreads > 300)
-      throw new ManifoldCFException("Illegal value for the number of expire threads");
+      throw new ManifoldCFException("Illegal value for the number of expire threads", ManifoldCFException.SETUP_ERROR);
     lowWaterFactor = (float)LockManagerFactory.getDoubleProperty(threadContext,ManifoldCF.lowWaterFactorProperty,5.0);
     if (lowWaterFactor < 1.0 || lowWaterFactor > 1000.0)
-      throw new ManifoldCFException("Illegal value for the low water factor");
+      throw new ManifoldCFException("Illegal value for the low water factor", ManifoldCFException.SETUP_ERROR);
     stuffAmtFactor = (float)LockManagerFactory.getDoubleProperty(threadContext,ManifoldCF.stuffAmtFactorProperty,2.0);
     if (stuffAmtFactor < 0.1 || stuffAmtFactor > 1000.0)
-      throw new ManifoldCFException("Illegal value for the stuffing amount factor");
+      throw new ManifoldCFException("Illegal value for the stuffing amount factor", ManifoldCFException.SETUP_ERROR);
 
 
     // Create the threads and objects.  This MUST be completed before there is any chance of "shutdownSystem" getting called.