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 13:31:40 UTC
svn commit: r1547787 - in /manifoldcf/branches/CONNECTORS-781/framework:
agents/src/main/java/org/apache/manifoldcf/agents/interfaces/
agents/src/main/java/org/apache/manifoldcf/agents/outputconnectorpool/
agents/src/main/java/org/apache/manifoldcf/age...
Author: kwright
Date: Wed Dec 4 12:31:39 2013
New Revision: 1547787
URL: http://svn.apache.org/r1547787
Log:
Add flushUnusedConnectors() method
Modified:
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IOutputConnectorPool.java
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/OutputConnectorFactory.java
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/outputconnectorpool/OutputConnectorPool.java
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java
manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.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/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/authorities/interfaces/IAuthorityConnectorPool.java
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/system/ManifoldCF.java
Modified: manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IOutputConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IOutputConnectorPool.java?rev=1547787&r1=1547786&r2=1547787&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IOutputConnectorPool.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IOutputConnectorPool.java Wed Dec 4 12:31:39 2013
@@ -64,6 +64,11 @@ public interface IOutputConnectorPool
public void pollAllConnectors()
throws ManifoldCFException;
+ /** Flush only those connector handles that are currently unused.
+ */
+ public void flushUnusedConnectors()
+ throws ManifoldCFException;
+
/** Clean up all open output connector handles.
* This method is called when the connector pool needs to be flushed,
* to free resources.
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=1547787&r1=1547786&r2=1547787&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 Wed Dec 4 12:31:39 2013
@@ -185,6 +185,14 @@ public class OutputConnectorFactory exte
thisFactory.pollThisAllConnectors(threadContext);
}
+ /** Flush only those connector handles that are currently unused.
+ */
+ public static void flushUnusedConnectors(IThreadContext threadContext)
+ throws ManifoldCFException
+ {
+ thisFactory.flushUnusedConnectors(threadContext);
+ }
+
/** Clean up all open output connector handles.
* This method is called when the connector pool needs to be flushed,
* to free resources.
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=1547787&r1=1547786&r2=1547787&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 Wed Dec 4 12:31:39 2013
@@ -50,6 +50,7 @@ public class OutputConnectorPool impleme
*@param orderingKeys are the keys which determine in what order the connectors are obtained.
*@param outputConnections are the connections to use the build the connector instances.
*/
+ @Override
public IOutputConnector[] grabMultiple(String[] orderingKeys, IOutputConnection[] outputConnections)
throws ManifoldCFException
{
@@ -73,6 +74,7 @@ public class OutputConnectorPool impleme
* The connector is specified by an output connection object.
*@param outputConnection is the output connection to base the connector instance on.
*/
+ @Override
public IOutputConnector grab(IOutputConnection outputConnection)
throws ManifoldCFException
{
@@ -83,6 +85,7 @@ public class OutputConnectorPool impleme
/** Release multiple output connectors.
*@param connectors are the connector instances to release.
*/
+ @Override
public void releaseMultiple(IOutputConnector[] connectors)
throws ManifoldCFException
{
@@ -92,6 +95,7 @@ public class OutputConnectorPool impleme
/** Release an output connector.
*@param connector is the connector to release.
*/
+ @Override
public void release(IOutputConnector connector)
throws ManifoldCFException
{
@@ -101,16 +105,27 @@ public class OutputConnectorPool impleme
/** Idle notification for inactive output connector handles.
* This method polls all inactive handles.
*/
+ @Override
public void pollAllConnectors()
throws ManifoldCFException
{
OutputConnectorFactory.pollAllConnectors(threadContext);
}
+ /** Flush only those connector handles that are currently unused.
+ */
+ @Override
+ public void flushUnusedConnectors()
+ throws ManifoldCFException
+ {
+ OutputConnectorFactory.flushUnusedConnectors(threadContext);
+ }
+
/** Clean up all open output connector handles.
* This method is called when the connector pool needs to be flushed,
* to free resources.
*/
+ @Override
public void closeAllConnectors()
throws ManifoldCFException
{
Modified: manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java?rev=1547787&r1=1547786&r2=1547787&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java Wed Dec 4 12:31:39 2013
@@ -160,6 +160,7 @@ public class AgentsDaemon
}
}
// Done.
+ OutputConnectorPoolFactory.make(threadContext).flushUnusedConnectors();
}
protected static String getAgentsClassServiceType(String agentClassName)
Modified: manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java?rev=1547787&r1=1547786&r2=1547787&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java Wed Dec 4 12:31:39 2013
@@ -81,6 +81,8 @@ public class ManifoldCF extends org.apac
}
catch (ManifoldCFException e)
{
+ if (Logging.agents != null)
+ Logging.agents.warn("Exception shutting down output connector pool: "+e.getMessage(),e);
}
}
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=1547787&r1=1547786&r2=1547787&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 Wed Dec 4 12:31:39 2013
@@ -429,6 +429,14 @@ public abstract class ConnectorFactory<T
// checkConnectors(System.currentTimeMillis());
}
+ /** Flush only those connector handles that are currently unused.
+ */
+ protected void flushThisUnusedConnectors(IThreadContext threadContext)
+ throws ManifoldCFException
+ {
+ closeThisAllConnectors(threadContext);
+ }
+
/** Clean up all open output connector handles.
* This method is called when the connector pool needs to be flushed,
* to free resources.
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=1547787&r1=1547786&r2=1547787&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 Wed Dec 4 12:31:39 2013
@@ -112,6 +112,15 @@ public class AuthorityConnectorPool impl
AuthorityConnectorFactory.pollAllConnectors(threadContext);
}
+ /** Flush only those connector handles that are currently unused.
+ */
+ @Override
+ public void flushUnusedConnectors()
+ throws ManifoldCFException
+ {
+ AuthorityConnectorFactory.flushUnusedConnectors(threadContext);
+ }
+
/** Clean up all open authority connector handles.
* This method is called when the connector pool needs to be flushed,
* to free resources.
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=1547787&r1=1547786&r2=1547787&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 Wed Dec 4 12:31:39 2013
@@ -172,6 +172,14 @@ public class AuthorityConnectorFactory e
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.
Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnectorPool.java?rev=1547787&r1=1547786&r2=1547787&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnectorPool.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnectorPool.java Wed Dec 4 12:31:39 2013
@@ -64,6 +64,11 @@ public interface IAuthorityConnectorPool
public void pollAllConnectors()
throws ManifoldCFException;
+ /** Flush only those connector handles that are currently unused.
+ */
+ public void flushUnusedConnectors()
+ throws ManifoldCFException;
+
/** Clean up all open authority connector handles.
* This method is called when the connector pool needs to be flushed,
* to free resources.
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=1547787&r1=1547786&r2=1547787&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 Wed Dec 4 12:31:39 2013
@@ -136,6 +136,14 @@ public class MappingConnectorFactory ext
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.
Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java?rev=1547787&r1=1547786&r2=1547787&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java Wed Dec 4 12:31:39 2013
@@ -83,6 +83,26 @@ public class ManifoldCF extends org.apac
public static void localCleanup(IThreadContext tc)
{
+ // Since pools are a shared resource, we clean them up only
+ // when we are certain nothing else is using them in the JVM.
+ try
+ {
+ AuthorityConnectorPoolFactory.make(tc).closeAllConnectors();
+ }
+ catch (ManifoldCFException e)
+ {
+ if (Logging.authorityService != null)
+ Logging.authorityService.warn("Exception closing authority connection pool: "+e.getMessage(),e);
+ }
+ try
+ {
+ MappingConnectorFactory.closeAllConnectors(tc);
+ }
+ catch (ManifoldCFException e)
+ {
+ if (Logging.authorityService != null)
+ Logging.authorityService.warn("Exception closing mapping connection pool: "+e.getMessage(),e);
+ }
}
/** Install all the authority manager system tables.
@@ -248,10 +268,10 @@ public class ManifoldCF extends org.apac
}
// Release all authority connectors
- AuthorityConnectorPoolFactory.make(threadContext).closeAllConnectors();
+ AuthorityConnectorPoolFactory.make(threadContext).flushUnusedConnectors();
numAuthCheckThreads = 0;
requestQueue = null;
- MappingConnectorFactory.closeAllConnectors(threadContext);
+ MappingConnectorFactory.flushUnusedConnectors(threadContext);
numMappingThreads = 0;
mappingRequestQueue = null;
}