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/03 20:13:07 UTC
svn commit: r1547530 - in /manifoldcf/branches/CONNECTORS-781/framework:
agents/src/main/java/org/apache/manifoldcf/agents/interfaces/
core/src/main/java/org/apache/manifoldcf/core/interfaces/
pull-agent/src/main/java/org/apache/manifoldcf/crawler/inte...
Author: kwright
Date: Tue Dec 3 19:13:07 2013
New Revision: 1547530
URL: http://svn.apache.org/r1547530
Log:
Figure out a way to make generics return a usable array of the correct type.
Modified:
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/OutputConnectorFactory.java
manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConnectorFactory.java
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/RepositoryConnectorFactory.java
Modified: manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/OutputConnectorFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/OutputConnectorFactory.java?rev=1547530&r1=1547529&r2=1547530&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/OutputConnectorFactory.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/OutputConnectorFactory.java Tue Dec 3 19:13:07 2013
@@ -142,7 +142,7 @@ public class OutputConnectorFactory exte
String[] orderingKeys, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
throws ManifoldCFException
{
- return thisFactory.grabThisMultiple(threadContext,orderingKeys,classNames,configInfos,maxPoolSizes);
+ return thisFactory.grabThisMultiple(threadContext,IOutputConnector.class,orderingKeys,classNames,configInfos,maxPoolSizes);
}
/** Get an output connector.
Modified: manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConnectorFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConnectorFactory.java?rev=1547530&r1=1547529&r2=1547530&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConnectorFactory.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConnectorFactory.java Tue Dec 3 19:13:07 2013
@@ -273,11 +273,11 @@ public abstract class ConnectorFactory<T
/** Get multiple connectors, all at once. Do this in a particular order
* so that any connector exhaustion will not cause a deadlock.
*/
- protected T[] grabThisMultiple(IThreadContext threadContext,
+ protected T[] grabThisMultiple(IThreadContext threadContext, Class<T> clazz,
String[] orderingKeys, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
throws ManifoldCFException
{
- T[] rval = (T[])new IConnector[classNames.length];
+ T[] rval = (T[])Array.newInstance(clazz,classNames.length);
Map<String,Integer> orderMap = new HashMap<String,Integer>();
for (int i = 0; i < orderingKeys.length; i++)
{
@@ -367,11 +367,10 @@ public abstract class ConnectorFactory<T
protected void releaseThisMultiple(T[] connectors)
throws ManifoldCFException
{
- int i = 0;
ManifoldCFException currentException = null;
- while (i < connectors.length)
+ for (int i = 0; i < connectors.length; i++)
{
- T c = connectors[i++];
+ T c = connectors[i];
try
{
releaseThis(c);
@@ -398,19 +397,13 @@ public abstract class ConnectorFactory<T
// Figure out which pool this goes on, and put it there
PoolKey pk = new PoolKey(connector.getClass().getName(),connector.getConfiguration());
- Pool p;
+ Pool<T> p;
synchronized (poolHash)
{
p = poolHash.get(pk);
}
p.releaseConnector(connector);
-
- // synchronized (checkedOutConnectors)
- // {
- // checkedOutConnectors.remove(connector.toString());
- // }
-
}
/** Idle notification for inactive output connector handles.
Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/RepositoryConnectorFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/RepositoryConnectorFactory.java?rev=1547530&r1=1547529&r2=1547530&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/RepositoryConnectorFactory.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/RepositoryConnectorFactory.java Tue Dec 3 19:13:07 2013
@@ -188,7 +188,7 @@ public class RepositoryConnectorFactory
String[] orderingKeys, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
throws ManifoldCFException
{
- return thisFactory.grabThisMultiple(threadContext,orderingKeys,classNames,configInfos,maxPoolSizes);
+ return thisFactory.grabThisMultiple(threadContext,IRepositoryConnector.class,orderingKeys,classNames,configInfos,maxPoolSizes);
}
/** Get a repository connector.