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/06 10:45:35 UTC
svn commit: r1548474 - in /manifoldcf/branches/CONNECTORS-781/framework:
agents/src/main/java/org/apache/manifoldcf/agents/outputconnectorpool/
core/src/main/java/org/apache/manifoldcf/core/connectorpool/
pull-agent/src/main/java/org/apache/manifoldcf/...
Author: kwright
Date: Fri Dec 6 09:45:35 2013
New Revision: 1548474
URL: http://svn.apache.org/r1548474
Log:
Polling now cleans up dead pools.
Modified:
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/outputconnectorpool/OutputConnectorPool.java
manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.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/mappingconnectorpool/MappingConnectorPool.java
manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repositoryconnectorpool/RepositoryConnectorPool.java
Modified: manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/outputconnectorpool/OutputConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/outputconnectorpool/OutputConnectorPool.java?rev=1548474&r1=1548473&r2=1548474&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/outputconnectorpool/OutputConnectorPool.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/outputconnectorpool/OutputConnectorPool.java Fri Dec 6 09:45:35 2013
@@ -172,6 +172,14 @@ public class OutputConnectorPool impleme
return connectorManager.isInstalled(className);
}
+ @Override
+ protected boolean isConnectionNameValid(IThreadContext tc, String connectionName)
+ throws ManifoldCFException
+ {
+ IOutputConnectionManager connectionManager = OutputConnectionManagerFactory.make(tc);
+ return connectionManager.load(connectionName) != null;
+ }
+
public IOutputConnector[] grabMultiple(IThreadContext tc, String[] orderingKeys, String[] connectionNames, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
throws ManifoldCFException
{
Modified: manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java?rev=1548474&r1=1548473&r2=1548474&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java Fri Dec 6 09:45:35 2013
@@ -46,6 +46,11 @@ public abstract class ConnectorPool<T ex
protected abstract boolean isInstalled(IThreadContext tc, String className)
throws ManifoldCFException;
+ /** Override this method to check if a connection name is still valid.
+ */
+ protected abstract boolean isConnectionNameValid(IThreadContext tc, String connectionName)
+ throws ManifoldCFException;
+
/** Get a connector instance.
*@param className is the class name.
*@return the instance.
@@ -273,11 +278,18 @@ public abstract class ConnectorPool<T ex
// Go through the whole pool and notify everyone
synchronized (poolHash)
{
- Iterator<Pool> iter = poolHash.values().iterator();
+ Iterator<String> iter = poolHash.keySet().iterator();
while (iter.hasNext())
{
- Pool p = iter.next();
- p.pollAll(threadContext);
+ String connectionName = iter.next();
+ Pool p = poolHash.get(connectionName);
+ if (isConnectionNameValid(threadContext,connectionName))
+ p.pollAll(threadContext);
+ else
+ {
+ p.releaseAll(threadContext);
+ iter.remove();
+ }
}
}
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=1548474&r1=1548473&r2=1548474&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 Fri Dec 6 09:45:35 2013
@@ -158,6 +158,14 @@ public class AuthorityConnectorPool impl
IAuthorityConnectorManager connectorManager = AuthorityConnectorManagerFactory.make(tc);
return connectorManager.isInstalled(className);
}
+
+ @Override
+ protected boolean isConnectionNameValid(IThreadContext tc, String connectionName)
+ throws ManifoldCFException
+ {
+ IAuthorityConnectionManager connectionManager = AuthorityConnectionManagerFactory.make(tc);
+ return connectionManager.load(connectionName) != null;
+ }
public IAuthorityConnector[] grabMultiple(IThreadContext tc, String[] orderingKeys, String connectionNames[], String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
throws ManifoldCFException
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=1548474&r1=1548473&r2=1548474&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 Fri Dec 6 09:45:35 2013
@@ -160,6 +160,14 @@ public class MappingConnectorPool implem
return connectorManager.isInstalled(className);
}
+ @Override
+ protected boolean isConnectionNameValid(IThreadContext tc, String connectionName)
+ throws ManifoldCFException
+ {
+ IMappingConnectionManager connectionManager = MappingConnectionManagerFactory.make(tc);
+ return connectionManager.load(connectionName) != null;
+ }
+
public IMappingConnector[] grabMultiple(IThreadContext tc, String[] orderingKeys, String[] connectionNames, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
throws ManifoldCFException
{
Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repositoryconnectorpool/RepositoryConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repositoryconnectorpool/RepositoryConnectorPool.java?rev=1548474&r1=1548473&r2=1548474&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repositoryconnectorpool/RepositoryConnectorPool.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repositoryconnectorpool/RepositoryConnectorPool.java Fri Dec 6 09:45:35 2013
@@ -159,6 +159,14 @@ public class RepositoryConnectorPool imp
return connectorManager.isInstalled(className);
}
+ @Override
+ protected boolean isConnectionNameValid(IThreadContext tc, String connectionName)
+ throws ManifoldCFException
+ {
+ IRepositoryConnectionManager connectionManager = RepositoryConnectionManagerFactory.make(tc);
+ return connectionManager.load(connectionName) != null;
+ }
+
public IRepositoryConnector[] grabMultiple(IThreadContext tc, String[] orderingKeys, String[] connectionNames, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
throws ManifoldCFException
{