Author: kwright
Date: Fri Nov 22 15:53:44 2013
New Revision: 1544588
URL: http://svn.apache.org/r1544588
Log:
Augment IAgent interface to support cleanup methods
Modified:
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IAgent.java
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
Modified:
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IAgent.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IAgent.java?rev=1544588&r1=1544587&r2=1544588&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IAgent.java
(original)
+++
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IAgent.java
Fri Nov 22 15:53:44 2013
@@ -41,6 +41,24 @@ public interface IAgent
public void deinstall()
throws ManifoldCFException;
+ /** Cleanup after ALL agents processes.
+ * Call this method to clean up dangling persistent state when a cluster is
just starting
+ * to come up. This method CANNOT be called when there are any active agents
+ * processes at all.
+ */
+ public void cleanUpAgentData()
+ throws ManifoldCFException;
+
+ /** Cleanup after agents process.
+ * Call this method to clean up dangling persistent state after agent has
been stopped.
+ * This method CANNOT be called when the agent is active, but it can
+ * be called at any time and by any process in order to guarantee that a
terminated
+ * agent does not block other agents from completing their tasks.
+ *@param processID is the process ID of the agent to clean up after.
+ */
+ public void cleanUpAgentData(String processID)
+ throws ManifoldCFException;
+
/** Start the agent. This method should spin up the agent threads, and
* then return.
*/
@@ -77,4 +95,11 @@ public interface IAgent
public void noteOutputConnectionChange(String connectionName)
throws ManifoldCFException;
+ /** Signal that an output connection needs to be "redone". This means that
all documents sent to that output connection must be sent again,
+ * and the history as to their status must be forgotten.
+ *@param connectionName is the name of the connection being signalled.
+ */
+ public void signalOutputConnectionRedo(String connectionName)
+ throws ManifoldCFException;
+
}
Modified:
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java?rev=1544588&r1=1544587&r2=1544588&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
(original)
+++
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
Fri Nov 22 15:53:44 2013
@@ -41,6 +41,7 @@ public class CrawlerAgent implements IAg
/** Install agent. This usually installs the agent's database tables etc.
*/
+ @Override
public void install()
throws ManifoldCFException
{
@@ -50,15 +51,43 @@ public class CrawlerAgent implements IAg
/** Uninstall agent. This must clean up everything the agent is responsible
for.
*/
+ @Override
public void deinstall()
throws ManifoldCFException
{
ManifoldCF.deinstallSystemTables(threadContext);
}
+ /** Cleanup after ALL agents processes.
+ * Call this method to clean up dangling persistent state when a cluster is
just starting
+ * to come up. This method CANNOT be called when there are any active agents
+ * processes at all.
+ */
+ @Override
+ public void cleanUpAgentData()
+ throws ManifoldCFException
+ {
+ ManifoldCF.cleanupProcessData(threadContext);
+ }
+
+ /** Cleanup after agents process.
+ * Call this method to clean up dangling persistent state after agent has
been stopped.
+ * This method CANNOT be called when the agent is active, but it can
+ * be called at any time and by any process in order to guarantee that a
terminated
+ * agent does not block other agents from completing their tasks.
+ *@param processID is the process ID of the agent to clean up after.
+ */
+ @Override
+ public void cleanUpAgentData(String processID)
+ throws ManifoldCFException
+ {
+ ManifoldCF.cleanupProcessData(threadContext, processID);
+ }
+
/** Start the agent. This method should spin up the agent threads, and
* then return.
*/
+ @Override
public void startAgent()
throws ManifoldCFException
{
@@ -69,6 +98,7 @@ public class CrawlerAgent implements IAg
/** Stop the agent. This should shut down the agent threads.
*/
+ @Override
public void stopAgent()
throws ManifoldCFException
{
@@ -81,6 +111,7 @@ public class CrawlerAgent implements IAg
*@param connName is the name of the output connection.
*@return true if the connection is in use, false otherwise.
*/
+ @Override
public boolean isOutputConnectionInUse(String connName)
throws ManifoldCFException
{
@@ -90,6 +121,7 @@ public class CrawlerAgent implements IAg
/** Note the deregistration of a set of output connections.
*@param connectionNames are the names of the connections being deregistered.
*/
+ @Override
public void noteOutputConnectorDeregistration(String[] connectionNames)
throws ManifoldCFException
{
@@ -99,6 +131,7 @@ public class CrawlerAgent implements IAg
/** Note the registration of a set of output connections.
*@param connectionNames are the names of the connections being registered.
*/
+ @Override
public void noteOutputConnectorRegistration(String[] connectionNames)
throws ManifoldCFException
{
@@ -108,6 +141,7 @@ public class CrawlerAgent implements IAg
/** Note a change in configuration for an output connection.
*@param connectionName is the name of the connections being changed.
*/
+ @Override
public void noteOutputConnectionChange(String connectionName)
throws ManifoldCFException
{
@@ -118,6 +152,7 @@ public class CrawlerAgent implements IAg
* and the history as to their status must be forgotten.
*@param connectionName is the name of the connection being signalled.
*/
+ @Override
public void signalOutputConnectionRedo(String connectionName)
throws ManifoldCFException
{
Modified:
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java?rev=1544588&r1=1544587&r2=1544588&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
(original)
+++
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
Fri Nov 22 15:53:44 2013
@@ -586,7 +586,24 @@ public class ManifoldCF extends org.apac
org.apache.manifoldcf.authorities.system.ManifoldCF.deinstallSystemTables(threadcontext);
}
-
+ /** Cleanup process data for a process.
+ */
+ public static void cleanupProcessData(IThreadContext threadContext, String
processID)
+ throws ManifoldCFException
+ {
+ IJobManager jobManager = JobManagerFactory.make(threadContext);
+ jobManager.cleanupProcessData(processID);
+ }
+
+ /** Cleanup process data for ALL processes.
+ */
+ public static void cleanupProcessData(IThreadContext threadContext)
+ throws ManifoldCFException
+ {
+ IJobManager jobManager = JobManagerFactory.make(threadContext);
+ jobManager.prepareForClusterStart();
+ }
+
/** Start everything.
*/
public static void startSystem(IThreadContext threadContext)