manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1545030 - /manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java
Date Sun, 24 Nov 2013 18:48:51 GMT
Author: kwright
Date: Sun Nov 24 18:48:51 2013
New Revision: 1545030

URL: http://svn.apache.org/r1545030
Log:
Remove all registrations when we do a cluster init

Modified:
    manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java

Modified: manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java?rev=1545030&r1=1545029&r2=1545030&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java
(original)
+++ manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java
Sun Nov 24 18:48:51 2013
@@ -237,25 +237,33 @@ public class ManifoldCF extends org.apac
         {
           // Start this agent
           IAgent agent = AgentFactory.make(className);
+          agent.initialize(threadContext);
           try
           {
             // Throw a lock, so that cleanup processes and startup processes don't collide.
             String lockName = getAgentsClassLockName(className);
+            String serviceType = getAgentsClassServiceType(className);
             boolean firstTime;
             lockManager.enterWriteLock(lockName);
             try
             {
-              firstTime = lockManager.registerServiceBeginServiceActivity(getAgentsClassServiceType(className),
processID);
+              firstTime = lockManager.registerServiceBeginServiceActivity(serviceType, processID);
+              if (firstTime)
+              {
+                agent.cleanUpAgentData(threadContext);
+                String[] deadAgents = lockManager.getInactiveServices(serviceType);
+                for (String deadAgent : deadAgents)
+                {
+                  lockManager.unregisterService(serviceType, deadAgent);
+                }
+              }
             }
             finally
             {
               lockManager.leaveWriteLock(lockName);
             }
             // Now initialize agent, being sure to clean up data from previous incarnations
-            agent.initialize(threadContext);
-            if (firstTime)
-              agent.cleanUpAgentData(threadContext);
-            else
+            if (!firstTime)
               agent.cleanUpAgentData(threadContext, 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.



Mime
View raw message