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:31:46 UTC
svn commit: r1547975 - in /manifoldcf/branches/CONNECTORS-781/framework:
crawler-ui/src/main/webapp/
pull-agent/src/main/java/org/apache/manifoldcf/authorities/
pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorityconnectorpool/
pull-age...
Author: kwright
Date: Thu Dec 5 00:31:46 2013
New Revision: 1547975
URL: http://svn.apache.org/r1547975
Log:
Move static pool to AuthorityConnectorPool class
Modified:
manifoldcf/branches/CONNECTORS-781/framework/crawler-ui/src/main/webapp/viewauthority.jsp
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorityconnectorpool/AuthorityConnectorPool.java
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityConnectorFactory.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/viewauthority.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/crawler-ui/src/main/webapp/viewauthority.jsp?rev=1547975&r1=1547974&r2=1547975&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/crawler-ui/src/main/webapp/viewauthority.jsp (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/crawler-ui/src/main/webapp/viewauthority.jsp Thu Dec 5 00:31:46 2013
@@ -67,6 +67,7 @@
{
IAuthorityConnectionManager manager = AuthorityConnectionManagerFactory.make(threadContext);
IAuthorityConnectorManager connectorManager = AuthorityConnectorManagerFactory.make(threadContext);
+ IAuthorityConnectorPool authorityConnectorPool = AuthorityConnectorPoolFactory.make(threadContext);
String connectionName = variableContext.getParameter("connname");
IAuthorityConnection connection = manager.load(connectionName);
if (connection == null)
@@ -101,7 +102,7 @@
String connectionStatus;
try
{
- IAuthorityConnector c = AuthorityConnectorFactory.grab(threadContext,className,parameters,maxCount);
+ IAuthorityConnector c = authorityConnectorPool.grab(connection);
if (c == null)
{
connectionStatus = Messages.getString(pageContext.getRequest().getLocale(),"viewauthority.Connectorisnotinstalled");
@@ -114,7 +115,7 @@
}
finally
{
- AuthorityConnectorFactory.release(c);
+ authorityConnectorPool.release(c);
}
}
}
Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java?rev=1547975&r1=1547974&r2=1547975&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java Thu Dec 5 00:31:46 2013
@@ -46,6 +46,7 @@ public class CheckAll
{
IThreadContext tc = ThreadContextFactory.make();
ManifoldCF.initializeEnvironment(tc);
+ IAuthorityConnectorPool authorityConnectorPool = AuthorityConnectorPoolFactory.make(tc);
// Now, get a list of the authority connections
IAuthorityConnectionManager mgr = AuthorityConnectionManagerFactory.make(tc);
IAuthorityConnection[] connections = mgr.getAllConnections();
@@ -70,7 +71,7 @@ public class CheckAll
String connectionStatus;
try
{
- IAuthorityConnector c = AuthorityConnectorFactory.grab(tc,className,parameters,maxCount);
+ IAuthorityConnector c = authorityConnectorPool.grab(connection);
if (c != null)
{
try
@@ -79,7 +80,7 @@ public class CheckAll
}
finally
{
- AuthorityConnectorFactory.release(c);
+ authorityConnectorPool.release(c);
}
}
else
Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorityconnectorpool/AuthorityConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorityconnectorpool/AuthorityConnectorPool.java?rev=1547975&r1=1547974&r2=1547975&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorityconnectorpool/AuthorityConnectorPool.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorityconnectorpool/AuthorityConnectorPool.java Thu Dec 5 00:31:46 2013
@@ -32,6 +32,9 @@ public class AuthorityConnectorPool impl
{
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 AuthorityConnectorFactory.
@@ -66,7 +69,7 @@ public class AuthorityConnectorPool impl
configInfos[i] = authorityConnections[i].getConfigParams();
maxPoolSizes[i] = authorityConnections[i].getMaxConnections();
}
- return AuthorityConnectorFactory.grabMultiple(threadContext,
+ return localPool.grabMultiple(threadContext,
orderingKeys, classNames, configInfos, maxPoolSizes);
}
@@ -78,7 +81,7 @@ public class AuthorityConnectorPool impl
public IAuthorityConnector grab(IAuthorityConnection authorityConnection)
throws ManifoldCFException
{
- return AuthorityConnectorFactory.grab(threadContext, authorityConnection.getClassName(),
+ return localPool.grab(threadContext, authorityConnection.getClassName(),
authorityConnection.getConfigParams(), authorityConnection.getMaxConnections());
}
@@ -89,7 +92,7 @@ public class AuthorityConnectorPool impl
public void releaseMultiple(IAuthorityConnector[] connectors)
throws ManifoldCFException
{
- AuthorityConnectorFactory.releaseMultiple(connectors);
+ localPool.releaseMultiple(connectors);
}
/** Release an authority connector.
@@ -99,7 +102,7 @@ public class AuthorityConnectorPool impl
public void release(IAuthorityConnector connector)
throws ManifoldCFException
{
- AuthorityConnectorFactory.release(connector);
+ localPool.release(connector);
}
/** Idle notification for inactive authority connector handles.
@@ -109,7 +112,7 @@ public class AuthorityConnectorPool impl
public void pollAllConnectors()
throws ManifoldCFException
{
- AuthorityConnectorFactory.pollAllConnectors(threadContext);
+ localPool.pollAllConnectors(threadContext);
}
/** Flush only those connector handles that are currently unused.
@@ -118,7 +121,7 @@ public class AuthorityConnectorPool impl
public void flushUnusedConnectors()
throws ManifoldCFException
{
- AuthorityConnectorFactory.flushUnusedConnectors(threadContext);
+ localPool.flushUnusedConnectors(threadContext);
}
/** Clean up all open authority connector handles.
@@ -129,7 +132,30 @@ public class AuthorityConnectorPool impl
public void closeAllConnectors()
throws ManifoldCFException
{
- AuthorityConnectorFactory.closeAllConnectors(threadContext);
+ localPool.closeAllConnectors(threadContext);
+ }
+
+ /** Actual static output connector pool */
+ protected static class LocalPool extends org.apache.manifoldcf.core.connectorpool.ConnectorPool<IAuthorityConnector>
+ {
+ public LocalPool()
+ {
+ }
+
+ @Override
+ protected boolean isInstalled(IThreadContext tc, String className)
+ throws ManifoldCFException
+ {
+ IAuthorityConnectorManager connectorManager = AuthorityConnectorManagerFactory.make(tc);
+ return connectorManager.isInstalled(className);
+ }
+
+ public IAuthorityConnector[] grabMultiple(IThreadContext tc, String[] orderingKeys, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
+ throws ManifoldCFException
+ {
+ return grabMultiple(tc,IAuthorityConnector.class,orderingKeys,classNames,configInfos,maxPoolSizes);
+ }
+
}
}
Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityConnectorFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityConnectorFactory.java?rev=1547975&r1=1547974&r2=1547975&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityConnectorFactory.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityConnectorFactory.java Thu Dec 5 00:31:46 2013
@@ -122,74 +122,5 @@ public class AuthorityConnectorFactory e
return thisFactory.getThisConnectorNoCheck(className);
}
- /** Get multiple authority connectors, all at once. Do this in a particular order
- * so that any connector exhaustion will not cause a deadlock.
- */
- public static IAuthorityConnector[] grabMultiple(IThreadContext threadContext,
- String[] orderingKeys, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
- throws ManifoldCFException
- {
- return thisFactory.grabThisMultiple(threadContext,IAuthorityConnector.class,orderingKeys,classNames,configInfos,maxPoolSizes);
- }
-
- /** Get an authority 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 IAuthorityConnector grab(IThreadContext threadContext,
- String className, ConfigParams configInfo, int maxPoolSize)
- throws ManifoldCFException
- {
- return thisFactory.grabThis(threadContext,className,configInfo,maxPoolSize);
- }
-
- /** Release multiple authority connectors.
- */
- public static void releaseMultiple(IAuthorityConnector[] connectors)
- throws ManifoldCFException
- {
- thisFactory.releaseThisMultiple(connectors);
- }
-
- /** Release an authority connector.
- *@param connector is the connector to release.
- */
- public static void release(IAuthorityConnector connector)
- throws ManifoldCFException
- {
- thisFactory.releaseThis(connector);
- }
-
- /** Idle notification for inactive authority 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 authority 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/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=1547975&r1=1547974&r2=1547975&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:31:46 2013
@@ -1267,6 +1267,7 @@ public class ManifoldCF extends org.apac
{
try
{
+ IAuthorityConnectorPool authorityConnectorPool = AuthorityConnectorPoolFactory.make(tc);
IAuthorityConnectionManager connectionManager = AuthorityConnectionManagerFactory.make(tc);
IAuthorityConnection connection = connectionManager.load(connectionName);
if (connection == null)
@@ -1277,7 +1278,7 @@ public class ManifoldCF extends org.apac
String results;
// Grab a connection handle, and call the test method
- IAuthorityConnector connector = AuthorityConnectorFactory.grab(tc,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+ IAuthorityConnector connector = authorityConnectorPool.grab(connection);
try
{
results = connector.check();
@@ -1288,7 +1289,7 @@ public class ManifoldCF extends org.apac
}
finally
{
- AuthorityConnectorFactory.release(connector);
+ authorityConnectorPool.release(connector);
}
ConfigurationNode response = new ConfigurationNode(API_CHECKRESULTNODE);