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/05 01:43:42 UTC
svn commit: r1547978 - in /manifoldcf/branches/CONNECTORS-781/framework:
crawler-ui/src/main/webapp/
pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/
pull-agent/src/main/java/org/apache/manifoldcf/authorities/mappingconnectorpool/...
Author: kwright
Date: Thu Dec 5 00:43:42 2013
New Revision: 1547978
URL: http://svn.apache.org/r1547978
Log:
Move mapping connector pool into mappingConnectorPool object
Modified:
manifoldcf/branches/CONNECTORS-781/framework/crawler-ui/src/main/webapp/viewmapper.jsp
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/MappingConnectorFactory.java
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/mappingconnectorpool/MappingConnectorPool.java
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
Modified: manifoldcf/branches/CONNECTORS-781/framework/crawler-ui/src/main/webapp/viewmapper.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/crawler-ui/src/main/webapp/viewmapper.jsp?rev=1547978&r1=1547977&r2=1547978&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/crawler-ui/src/main/webapp/viewmapper.jsp (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/crawler-ui/src/main/webapp/viewmapper.jsp Thu Dec 5 00:43:42 2013
@@ -67,6 +67,7 @@
{
IMappingConnectionManager manager = MappingConnectionManagerFactory.make(threadContext);
IMappingConnectorManager connectorManager = MappingConnectorManagerFactory.make(threadContext);
+ IMappingConnectorPool mappingConnectorPool = MappingConnectorPoolFactory.make(threadContext);
String connectionName = variableContext.getParameter("connname");
IMappingConnection connection = manager.load(connectionName);
if (connection == null)
@@ -91,7 +92,7 @@
String connectionStatus;
try
{
- IMappingConnector c = MappingConnectorFactory.grab(threadContext,className,parameters,maxCount);
+ IMappingConnector c = mappingConnectorPool.grab(connection);
if (c == null)
{
connectionStatus = Messages.getString(pageContext.getRequest().getLocale(),"viewmapper.Connectorisnotinstalled");
@@ -104,7 +105,7 @@
}
finally
{
- MappingConnectorFactory.release(c);
+ mappingConnectorPool.release(c);
}
}
}
Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/MappingConnectorFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/MappingConnectorFactory.java?rev=1547978&r1=1547977&r2=1547978&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/MappingConnectorFactory.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/MappingConnectorFactory.java Thu Dec 5 00:43:42 2013
@@ -104,75 +104,5 @@ public class MappingConnectorFactory ext
return thisFactory.getThisConnectorNoCheck(className);
}
- /** Get multiple mapping connectors, all at once. Do this in a particular order
- * so that any connector exhaustion will not cause a deadlock.
- */
- public static IMappingConnector[] grabMultiple(IThreadContext threadContext,
- String[] orderingKeys, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
- throws ManifoldCFException
- {
- return thisFactory.grabThisMultiple(threadContext,IMappingConnector.class,orderingKeys,classNames,configInfos,maxPoolSizes);
- }
-
- /** Get a mapping connector.
- * The connector is specified by its class and its parameters.
- *@param threadContext is the current thread context.
- *@param className is the name of the class to get a connector for.
- *@param configInfo are the name/value pairs constituting configuration info
- * for this class.
- */
- public static IMappingConnector grab(IThreadContext threadContext,
- String className, ConfigParams configInfo, int maxPoolSize)
- throws ManifoldCFException
- {
- return thisFactory.grabThis(threadContext,className,configInfo,maxPoolSize);
- }
-
- /** Release multiple mapping connectors.
- */
- public static void releaseMultiple(IMappingConnector[] connectors)
- throws ManifoldCFException
- {
- thisFactory.releaseThisMultiple(connectors);
- }
-
- /** Release a repository connector.
- *@param connector is the connector to release.
- */
- public static void release(IMappingConnector connector)
- throws ManifoldCFException
- {
- thisFactory.releaseThis(connector);
- }
-
- /** Idle notification for inactive mapping connector handles.
- * This method polls all inactive handles.
- */
- public static void pollAllConnectors(IThreadContext threadContext)
- throws ManifoldCFException
- {
- thisFactory.pollThisAllConnectors(threadContext);
- }
-
- /** Flush only those connector handles that are currently unused.
- */
- public static void flushUnusedConnectors(IThreadContext threadContext)
- throws ManifoldCFException
- {
- thisFactory.flushThisUnusedConnectors(threadContext);
- }
-
- /** Clean up all open mapping connector handles.
- * This method is called when the connector pool needs to be flushed,
- * to free resources.
- *@param threadContext is the local thread context.
- */
- public static void closeAllConnectors(IThreadContext threadContext)
- throws ManifoldCFException
- {
- thisFactory.closeThisAllConnectors(threadContext);
- }
-
-
}
Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/mappingconnectorpool/MappingConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/mappingconnectorpool/MappingConnectorPool.java?rev=1547978&r1=1547977&r2=1547978&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/mappingconnectorpool/MappingConnectorPool.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/mappingconnectorpool/MappingConnectorPool.java Thu Dec 5 00:43:42 2013
@@ -32,6 +32,9 @@ public class MappingConnectorPool implem
{
public static final String _rcsid = "@(#)$Id$";
+ /** Local connector pool */
+ protected final static LocalPool localPool = new LocalPool();
+
// This implementation is a place-holder for the real one, which will likely fold in the pooling code
// as we strip it out of MappingConnectorFactory.
@@ -66,7 +69,7 @@ public class MappingConnectorPool implem
configInfos[i] = mappingConnections[i].getConfigParams();
maxPoolSizes[i] = mappingConnections[i].getMaxConnections();
}
- return MappingConnectorFactory.grabMultiple(threadContext,
+ return localPool.grabMultiple(threadContext,
orderingKeys, classNames, configInfos, maxPoolSizes);
}
@@ -78,7 +81,7 @@ public class MappingConnectorPool implem
public IMappingConnector grab(IMappingConnection mappingConnection)
throws ManifoldCFException
{
- return MappingConnectorFactory.grab(threadContext, mappingConnection.getClassName(),
+ return localPool.grab(threadContext, mappingConnection.getClassName(),
mappingConnection.getConfigParams(), mappingConnection.getMaxConnections());
}
@@ -89,7 +92,7 @@ public class MappingConnectorPool implem
public void releaseMultiple(IMappingConnector[] connectors)
throws ManifoldCFException
{
- MappingConnectorFactory.releaseMultiple(connectors);
+ localPool.releaseMultiple(connectors);
}
/** Release a mapping connector.
@@ -99,7 +102,7 @@ public class MappingConnectorPool implem
public void release(IMappingConnector connector)
throws ManifoldCFException
{
- MappingConnectorFactory.release(connector);
+ localPool.release(connector);
}
/** Idle notification for inactive mapping connector handles.
@@ -109,7 +112,7 @@ public class MappingConnectorPool implem
public void pollAllConnectors()
throws ManifoldCFException
{
- MappingConnectorFactory.pollAllConnectors(threadContext);
+ localPool.pollAllConnectors(threadContext);
}
/** Flush only those connector handles that are currently unused.
@@ -118,7 +121,7 @@ public class MappingConnectorPool implem
public void flushUnusedConnectors()
throws ManifoldCFException
{
- MappingConnectorFactory.flushUnusedConnectors(threadContext);
+ localPool.flushUnusedConnectors(threadContext);
}
/** Clean up all open mapping connector handles.
@@ -129,7 +132,30 @@ public class MappingConnectorPool implem
public void closeAllConnectors()
throws ManifoldCFException
{
- MappingConnectorFactory.closeAllConnectors(threadContext);
+ localPool.closeAllConnectors(threadContext);
+ }
+
+ /** Actual static mapping connector pool */
+ protected static class LocalPool extends org.apache.manifoldcf.core.connectorpool.ConnectorPool<IMappingConnector>
+ {
+ public LocalPool()
+ {
+ }
+
+ @Override
+ protected boolean isInstalled(IThreadContext tc, String className)
+ throws ManifoldCFException
+ {
+ IMappingConnectorManager connectorManager = MappingConnectorManagerFactory.make(tc);
+ return connectorManager.isInstalled(className);
+ }
+
+ public IMappingConnector[] grabMultiple(IThreadContext tc, String[] orderingKeys, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
+ throws ManifoldCFException
+ {
+ return grabMultiple(tc,IMappingConnector.class,orderingKeys,classNames,configInfos,maxPoolSizes);
+ }
+
}
}
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=1547978&r1=1547977&r2=1547978&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 Thu Dec 5 00:43:42 2013
@@ -1309,6 +1309,7 @@ public class ManifoldCF extends org.apac
{
try
{
+ IMappingConnectorPool mappingConnectorPool = MappingConnectorPoolFactory.make(tc);
IMappingConnectionManager connectionManager = MappingConnectionManagerFactory.make(tc);
IMappingConnection connection = connectionManager.load(connectionName);
if (connection == null)
@@ -1319,7 +1320,7 @@ public class ManifoldCF extends org.apac
String results;
// Grab a connection handle, and call the test method
- IMappingConnector connector = MappingConnectorFactory.grab(tc,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+ IMappingConnector connector = mappingConnectorPool.grab(connection);
try
{
results = connector.check();
@@ -1330,7 +1331,7 @@ public class ManifoldCF extends org.apac
}
finally
{
- MappingConnectorFactory.release(connector);
+ mappingConnectorPool.release(connector);
}
ConfigurationNode response = new ConfigurationNode(API_CHECKRESULTNODE);