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 2013/12/04 02:19:26 UTC

svn commit: r1547667 - in /manifoldcf/branches/CONNECTORS-781/framework: agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/ pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/

Author: kwright
Date: Wed Dec  4 01:19:25 2013
New Revision: 1547667

URL: http://svn.apache.org/r1547667
Log:
Use output connector pool everywhere we used to use OutputConnectorFactory

Modified:
    manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java
    manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java
    manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.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/incrementalingest/IncrementalIngester.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java?rev=1547667&r1=1547666&r2=1547667&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java Wed Dec  4 01:19:25 2013
@@ -79,7 +79,9 @@ public class IncrementalIngester extends
   protected ILockManager lockManager;
   // Output connection manager
   protected IOutputConnectionManager connectionManager;
-
+  // Output connector pool manager
+  protected IOutputConnectorPool outputConnectorPool;
+  
   /** Constructor.
   */
   public IncrementalIngester(IThreadContext threadContext, IDBInterface database)
@@ -89,6 +91,7 @@ public class IncrementalIngester extends
     this.threadContext = threadContext;
     lockManager = LockManagerFactory.make(threadContext);
     connectionManager = OutputConnectionManagerFactory.make(threadContext);
+    outputConnectorPool = OutputConnectorPoolFactory.make(threadContext);
   }
 
   /** Install the incremental ingestion manager.
@@ -203,7 +206,7 @@ public class IncrementalIngester extends
     throws ManifoldCFException, ServiceInterruption
   {
     IOutputConnection connection = connectionManager.load(outputConnectionName);
-    IOutputConnector connector = OutputConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+    IOutputConnector connector = outputConnectorPool.grab(connection);
     if (connector == null)
       // The connector is not installed; treat this as a service interruption.
       throw new ServiceInterruption("Output connector not installed",0L);
@@ -213,7 +216,7 @@ public class IncrementalIngester extends
     }
     finally
     {
-      OutputConnectorFactory.release(connector);
+      outputConnectorPool.release(connector);
     }
   }
 
@@ -228,7 +231,7 @@ public class IncrementalIngester extends
     throws ManifoldCFException, ServiceInterruption
   {
     IOutputConnection connection = connectionManager.load(outputConnectionName);
-    IOutputConnector connector = OutputConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+    IOutputConnector connector = outputConnectorPool.grab(connection);
     if (connector == null)
       // The connector is not installed; treat this as a service interruption.
       throw new ServiceInterruption("Output connector not installed",0L);
@@ -238,7 +241,7 @@ public class IncrementalIngester extends
     }
     finally
     {
-      OutputConnectorFactory.release(connector);
+      outputConnectorPool.release(connector);
     }
   }
 
@@ -254,7 +257,7 @@ public class IncrementalIngester extends
     throws ManifoldCFException, ServiceInterruption
   {
     IOutputConnection connection = connectionManager.load(outputConnectionName);
-    IOutputConnector connector = OutputConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+    IOutputConnector connector = outputConnectorPool.grab(connection);
     if (connector == null)
       // The connector is not installed; treat this as a service interruption.
       throw new ServiceInterruption("Output connector not installed",0L);
@@ -264,7 +267,7 @@ public class IncrementalIngester extends
     }
     finally
     {
-      OutputConnectorFactory.release(connector);
+      outputConnectorPool.release(connector);
     }
   }
 
@@ -280,7 +283,7 @@ public class IncrementalIngester extends
     throws ManifoldCFException, ServiceInterruption
   {
     IOutputConnection connection = connectionManager.load(outputConnectionName);
-    IOutputConnector connector = OutputConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+    IOutputConnector connector = outputConnectorPool.grab(connection);
     if (connector == null)
       // The connector is not installed; treat this as a service interruption.
       throw new ServiceInterruption("Output connector not installed",0L);
@@ -290,7 +293,7 @@ public class IncrementalIngester extends
     }
     finally
     {
-      OutputConnectorFactory.release(connector);
+      outputConnectorPool.release(connector);
     }
   }
 
@@ -304,7 +307,7 @@ public class IncrementalIngester extends
     throws ManifoldCFException, ServiceInterruption
   {
     IOutputConnection connection = connectionManager.load(outputConnectionName);
-    IOutputConnector connector = OutputConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+    IOutputConnector connector = outputConnectorPool.grab(connection);
     if (connector == null)
       // The connector is not installed; treat this as a service interruption.
       throw new ServiceInterruption("Output connector not installed",0L);
@@ -314,7 +317,7 @@ public class IncrementalIngester extends
     }
     finally
     {
-      OutputConnectorFactory.release(connector);
+      outputConnectorPool.release(connector);
     }
 
   }
@@ -1649,7 +1652,7 @@ public class IncrementalIngester extends
   {
     // Set indexing date
     document.setIndexingDate(new Date());
-    IOutputConnector connector = OutputConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+    IOutputConnector connector = outputConnectorPool.grab(connection);
     if (connector == null)
       // The connector is not installed; treat this as a service interruption.
       throw new ServiceInterruption("Output connector not installed",0L);
@@ -1659,7 +1662,7 @@ public class IncrementalIngester extends
     }
     finally
     {
-      OutputConnectorFactory.release(connector);
+      outputConnectorPool.release(connector);
     }
   }
 
@@ -1668,7 +1671,7 @@ public class IncrementalIngester extends
   protected void removeDocument(IOutputConnection connection, String documentURI, String outputDescription, IOutputRemoveActivity activities)
     throws ManifoldCFException, ServiceInterruption
   {
-    IOutputConnector connector = OutputConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+    IOutputConnector connector = outputConnectorPool.grab(connection);
     if (connector == null)
       // The connector is not installed; treat this as a service interruption.
       throw new ServiceInterruption("Output connector not installed",0L);
@@ -1678,7 +1681,7 @@ public class IncrementalIngester extends
     }
     finally
     {
-      OutputConnectorFactory.release(connector);
+      outputConnectorPool.release(connector);
     }
   }
 

Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java?rev=1547667&r1=1547666&r2=1547667&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java Wed Dec  4 01:19:25 2013
@@ -56,6 +56,8 @@ public class IdleCleanupThread extends T
       IThreadContext threadContext = ThreadContextFactory.make();
       // Get the cache handle.
       ICacheManager cacheManager = CacheManagerFactory.make(threadContext);
+      // Get the output connector pool handle
+      IOutputConnectorPool outputConnectorPool = OutputConnectorPoolFactory.make(threadContext);
       
       // Loop
       while (true)
@@ -65,7 +67,7 @@ public class IdleCleanupThread extends T
         {
           // Do the cleanup
           RepositoryConnectorFactory.pollAllConnectors(threadContext);
-          OutputConnectorFactory.pollAllConnectors(threadContext);
+          outputConnectorPool.pollAllConnectors();
           cacheManager.expireObjects(System.currentTimeMillis());
           
           // Sleep for the retry interval.

Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.java?rev=1547667&r1=1547666&r2=1547667&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.java Wed Dec  4 01:19:25 2013
@@ -61,6 +61,8 @@ public class JobNotificationThread exten
       IOutputConnectionManager connectionManager = OutputConnectionManagerFactory.make(threadContext);
       IRepositoryConnectionManager repositoryConnectionManager = RepositoryConnectionManagerFactory.make(threadContext);
 
+      IOutputConnectorPool outputConnectorPool = OutputConnectorPoolFactory.make(threadContext);
+      
       // Loop
       while (true)
       {
@@ -108,7 +110,7 @@ public class JobNotificationThread exten
               if (connection != null)
               {
                 // Grab an appropriate connection instance
-                IOutputConnector connector = OutputConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+                IOutputConnector connector = outputConnectorPool.grab(connection);
                 if (connector != null)
                 {
                   try
@@ -138,7 +140,7 @@ public class JobNotificationThread exten
                   }
                   finally
                   {
-                    OutputConnectorFactory.release(connector);
+                    outputConnectorPool.release(connector);
                   }
                 }
               }

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=1547667&r1=1547666&r2=1547667&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 Wed Dec  4 01:19:25 2013
@@ -1217,6 +1217,7 @@ public class ManifoldCF extends org.apac
   {
     try
     {
+      IOutputConnectorPool outputConnectorPool = OutputConnectorPoolFactory.make(tc);
       IOutputConnectionManager connectionManager = OutputConnectionManagerFactory.make(tc);
       IOutputConnection connection = connectionManager.load(connectionName);
       if (connection == null)
@@ -1227,7 +1228,7 @@ public class ManifoldCF extends org.apac
           
       String results;
       // Grab a connection handle, and call the test method
-      IOutputConnector connector = OutputConnectorFactory.grab(tc,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+      IOutputConnector connector = outputConnectorPool.grab(connection);
       try
       {
         results = connector.check();
@@ -1238,7 +1239,7 @@ public class ManifoldCF extends org.apac
       }
       finally
       {
-        OutputConnectorFactory.release(connector);
+        outputConnectorPool.release(connector);
       }
           
       ConfigurationNode response = new ConfigurationNode(API_CHECKRESULTNODE);
@@ -1382,6 +1383,7 @@ public class ManifoldCF extends org.apac
   {
     try
     {
+      IOutputConnectorPool outputConnectorPool = OutputConnectorPoolFactory.make(tc);
       IOutputConnectionManager connectionManager = OutputConnectionManagerFactory.make(tc);
       IOutputConnection connection = connectionManager.load(connectionName);
       if (connection == null)
@@ -1391,14 +1393,14 @@ public class ManifoldCF extends org.apac
       }
 
       // Grab a connection handle, and call the test method
-      IOutputConnector connector = OutputConnectorFactory.grab(tc,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+      IOutputConnector connector = outputConnectorPool.grab(connection);
       try
       {
         return connector.requestInfo(output,command)?READRESULT_FOUND:READRESULT_NOTFOUND;
       }
       finally
       {
-        OutputConnectorFactory.release(connector);
+        outputConnectorPool.release(connector);
       }
     }
     catch (ManifoldCFException e)