Return-Path: X-Original-To: apmail-manifoldcf-commits-archive@www.apache.org Delivered-To: apmail-manifoldcf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5380110E16 for ; Fri, 22 Nov 2013 15:54:13 +0000 (UTC) Received: (qmail 55982 invoked by uid 500); 22 Nov 2013 15:54:13 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 55930 invoked by uid 500); 22 Nov 2013 15:54:12 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 55904 invoked by uid 99); 22 Nov 2013 15:54:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Nov 2013 15:54:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Nov 2013 15:54:06 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 50A1E23889CB; Fri, 22 Nov 2013 15:53:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1544588 - in /manifoldcf/branches/CONNECTORS-781/framework: agents/src/main/java/org/apache/manifoldcf/agents/interfaces/ pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ Date: Fri, 22 Nov 2013 15:53:45 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131122155345.50A1E23889CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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)