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:21:24 UTC

svn commit: r1630536 - in /manifoldcf/branches/dev_1x: ./ 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:21:23 2014
New Revision: 1630536

URL: http://svn.apache.org/r1630536
Log:
Pull up fix for CONNECTORS-1070 from trunk.

Modified:
    manifoldcf/branches/dev_1x/   (props changed)
    manifoldcf/branches/dev_1x/CHANGES.txt
    manifoldcf/branches/dev_1x/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java
    manifoldcf/branches/dev_1x/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java

Propchange: manifoldcf/branches/dev_1x/
------------------------------------------------------------------------------
  Merged /manifoldcf/trunk:r1630535

Modified: manifoldcf/branches/dev_1x/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/CHANGES.txt?rev=1630536&r1=1630535&r2=1630536&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/CHANGES.txt (original)
+++ manifoldcf/branches/dev_1x/CHANGES.txt Thu Oct  9 17:21:23 2014
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 1.8-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/branches/dev_1x/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java?rev=1630536&r1=1630535&r2=1630536&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java (original)
+++ manifoldcf/branches/dev_1x/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java Thu Oct  9 17:21:23 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/branches/dev_1x/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java?rev=1630536&r1=1630535&r2=1630536&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java (original)
+++ manifoldcf/branches/dev_1x/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java Thu Oct  9 17:21:23 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.