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 2014/12/06 15:16:01 UTC
svn commit: r1643535 - in /manifoldcf/trunk:
connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/
framework/
framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/
framew...
Author: kwright
Date: Sat Dec 6 14:16:00 2014
New Revision: 1643535
URL: http://svn.apache.org/r1643535
Log:
Move throttling support to connectorcommon also.
Added:
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IConnectionThrottler.java
- copied, changed from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IFetchThrottler.java
- copied, changed from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IFetchThrottler.java
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IStreamThrottler.java
- copied, changed from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IStreamThrottler.java
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IThrottleGroups.java
- copied, changed from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleGroups.java
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IThrottleSpec.java
- copied, changed from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleSpec.java
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/ThrottleGroupsFactory.java
- copied, changed from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ThrottleGroupsFactory.java
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/system/
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/system/ManifoldCF.java (with props)
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/
- copied from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/
manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/throttler/
- copied from r1643193, manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/throttler/
Removed:
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IFetchThrottler.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IStreamThrottler.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleGroups.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleSpec.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ThrottleGroupsFactory.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/
manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/throttler/
Modified:
manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottleDescription.java
manifoldcf/trunk/framework/build.xml
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ConnectionBin.java
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/FetchBin.java
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ThrottleBin.java
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ThrottleGroups.java
manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/Throttler.java
manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/throttler/TestThrottler.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
Modified: manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottleDescription.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottleDescription.java?rev=1643535&r1=1643534&r2=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottleDescription.java (original)
+++ manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottleDescription.java Sat Dec 6 14:16:00 2014
@@ -19,6 +19,7 @@
package org.apache.manifoldcf.crawler.connectors.webcrawler;
import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.connectorcommon.interfaces.*;
import java.util.*;
import java.util.regex.*;
Modified: manifoldcf/trunk/framework/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/build.xml?rev=1643535&r1=1643534&r2=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/build.xml (original)
+++ manifoldcf/trunk/framework/build.xml Sat Dec 6 14:16:00 2014
@@ -1759,17 +1759,17 @@
<test name="org.apache.manifoldcf.core.common.DateTest" todir="test-output"/>
<test name="org.apache.manifoldcf.core.lockmanager.TestZooKeeperLocks" todir="test-output"/>
- <test name="org.apache.manifoldcf.core.throttler.TestThrottler" todir="test-output"/>
</junit>
</target>
- <target name="run-connector-common-tests" depends="compile-connector-common,compile-connector-common-tests,compile-core">
+ <target name="run-connector-common-tests" depends="compile-connector-common,compile-connector-common-tests,compile-core,compile-core-tests">
<mkdir dir="test-output"/>
<junit fork="true" maxmemory="128m" dir="test-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
<classpath>
<path refid="framework-classpath"/>
<pathelement location="build/core/classes"/>
+ <pathelement location="build/core-tests/classes"/>
<pathelement location="build/connector-common/classes"/>
<pathelement location="build/connector-common-tests/classes"/>
</classpath>
@@ -1777,6 +1777,7 @@
<test name="org.apache.manifoldcf.connectorcommon.fuzzyml.TestFuzzyML" todir="test-output"/>
<test name="org.apache.manifoldcf.connectorcommon.jsongen.TestJsonGen" todir="test-output"/>
+ <test name="org.apache.manifoldcf.connectorcommon.throttler.TestThrottler" todir="test-output"/>
</junit>
</target>
@@ -1899,7 +1900,6 @@
</classpath>
<formatter type="brief" usefile="false"/>
- <test name="org.apache.manifoldcf.core.throttler.TestThrottler" todir="test-HSQLDB-output"/>
<test name="org.apache.manifoldcf.agents.tests.SanityHSQLDBTest" todir="test-HSQLDB-output"/>
<test name="org.apache.manifoldcf.crawler.tests.SanityHSQLDBTest" todir="test-HSQLDB-output"/>
Copied: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IConnectionThrottler.java (from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java)
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IConnectionThrottler.java?p2=manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IConnectionThrottler.java&p1=manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java&r1=1643193&r2=1643535&rev=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IConnectionThrottler.java Sat Dec 6 14:16:00 2014
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.interfaces;
+package org.apache.manifoldcf.connectorcommon.interfaces;
import java.util.*;
Copied: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IFetchThrottler.java (from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IFetchThrottler.java)
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IFetchThrottler.java?p2=manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IFetchThrottler.java&p1=manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IFetchThrottler.java&r1=1643193&r2=1643535&rev=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IFetchThrottler.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IFetchThrottler.java Sat Dec 6 14:16:00 2014
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.interfaces;
+package org.apache.manifoldcf.connectorcommon.interfaces;
/** An IFetchThrottler object is meant to be used as part of a fetch cycle. It is not
* thread-local, and does not require access to a thread context. It thus also does not
Copied: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IStreamThrottler.java (from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IStreamThrottler.java)
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IStreamThrottler.java?p2=manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IStreamThrottler.java&p1=manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IStreamThrottler.java&r1=1643193&r2=1643535&rev=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IStreamThrottler.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IStreamThrottler.java Sat Dec 6 14:16:00 2014
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.interfaces;
+package org.apache.manifoldcf.connectorcommon.interfaces;
/** An IConnectionThrottler object is meant to be embedded in an InputStream. It is not
* thread-local, and does not require access to a thread context. It thus also does not
Copied: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IThrottleGroups.java (from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleGroups.java)
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IThrottleGroups.java?p2=manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IThrottleGroups.java&p1=manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleGroups.java&r1=1643193&r2=1643535&rev=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleGroups.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IThrottleGroups.java Sat Dec 6 14:16:00 2014
@@ -16,7 +16,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.interfaces;
+package org.apache.manifoldcf.connectorcommon.interfaces;
+
+import org.apache.manifoldcf.core.interfaces.*;
import java.util.*;
Copied: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IThrottleSpec.java (from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleSpec.java)
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IThrottleSpec.java?p2=manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IThrottleSpec.java&p1=manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleSpec.java&r1=1643193&r2=1643535&rev=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleSpec.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IThrottleSpec.java Sat Dec 6 14:16:00 2014
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.interfaces;
+package org.apache.manifoldcf.connectorcommon.interfaces;
/** An IThrottleSpec object describes what throttling criteria to apply
Copied: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/ThrottleGroupsFactory.java (from r1643193, manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ThrottleGroupsFactory.java)
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/ThrottleGroupsFactory.java?p2=manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/ThrottleGroupsFactory.java&p1=manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ThrottleGroupsFactory.java&r1=1643193&r2=1643535&rev=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ThrottleGroupsFactory.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/ThrottleGroupsFactory.java Sat Dec 6 14:16:00 2014
@@ -16,7 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.interfaces;
+package org.apache.manifoldcf.connectorcommon.interfaces;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.core.system.ManifoldCF;
/** Thread-local IThrottleGroups factory.
*/
@@ -41,10 +44,66 @@ public class ThrottleGroupsFactory
Object o = tc.get(objectName);
if (o == null || !(o instanceof IThrottleGroups))
{
- o = new org.apache.manifoldcf.core.throttler.ThrottleGroups(tc);
+ o = new org.apache.manifoldcf.connectorcommon.throttler.ThrottleGroups(tc);
tc.save(objectName,o);
}
return (IThrottleGroups)o;
}
+ /** Class that polls throttler */
+ protected static class ThrottlerPoll implements IPollingHook
+ {
+ public ThrottlerPoll()
+ {
+ }
+
+ @Override
+ public void doPoll(IThreadContext threadContext)
+ throws ManifoldCFException
+ {
+ IThrottleGroups connectionThrottler = ThrottleGroupsFactory.make(threadContext);
+ connectionThrottler.poll();
+ }
+ }
+
+ /** Register the throttle groups ManifoldCF service.
+ */
+ public static void register()
+ {
+ ManifoldCF.addShutdownHook(new ThrottlerShutdown());
+ ManifoldCF.addPollingHook(new ThrottlerPoll());
+ }
+
+ /** Class that cleans up throttler on exit */
+ protected static class ThrottlerShutdown implements IShutdownHook
+ {
+ public ThrottlerShutdown()
+ {
+ }
+
+ @Override
+ public void doCleanup(IThreadContext threadContext)
+ throws ManifoldCFException
+ {
+ IThrottleGroups connectionThrottler = ThrottleGroupsFactory.make(threadContext);
+ connectionThrottler.destroy();
+ }
+
+ /** Finalizer, which is designed to catch class unloading that tomcat 5.5 does.
+ */
+ protected void finalize()
+ throws Throwable
+ {
+ try
+ {
+ doCleanup(ThreadContextFactory.make());
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ }
+
}
Added: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/system/ManifoldCF.java?rev=1643535&view=auto
==============================================================================
--- manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/system/ManifoldCF.java (added)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/system/ManifoldCF.java Sat Dec 6 14:16:00 2014
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.connectorcommon.system;
+
+import org.apache.manifoldcf.connectorcommon.interfaces.*;
+
+public class ManifoldCF
+{
+ public static final String _rcsid = "@(#)$Id$";
+
+ public static void registerConnectorServices()
+ {
+ ThrottleGroupsFactory.register();
+ }
+
+}
\ No newline at end of file
Propchange: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/system/ManifoldCF.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/system/ManifoldCF.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ConnectionBin.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ConnectionBin.java?rev=1643535&r1=1643193&r2=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ConnectionBin.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ConnectionBin.java Sat Dec 6 14:16:00 2014
@@ -16,9 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.throttler;
+package org.apache.manifoldcf.connectorcommon.throttler;
import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.connectorcommon.interfaces.*;
import org.apache.manifoldcf.core.system.ManifoldCF;
import java.util.concurrent.atomic.*;
import java.util.*;
Modified: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/FetchBin.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/FetchBin.java?rev=1643535&r1=1643193&r2=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/FetchBin.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/FetchBin.java Sat Dec 6 14:16:00 2014
@@ -16,9 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.throttler;
+package org.apache.manifoldcf.connectorcommon.throttler;
import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.connectorcommon.interfaces.*;
import org.apache.manifoldcf.core.system.ManifoldCF;
/** Connection tracking for a bin.
Modified: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ThrottleBin.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ThrottleBin.java?rev=1643535&r1=1643193&r2=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ThrottleBin.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ThrottleBin.java Sat Dec 6 14:16:00 2014
@@ -16,9 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.throttler;
+package org.apache.manifoldcf.connectorcommon.throttler;
import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.connectorcommon.interfaces.*;
import org.apache.manifoldcf.core.system.ManifoldCF;
import java.util.*;
Modified: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ThrottleGroups.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ThrottleGroups.java?rev=1643535&r1=1643193&r2=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ThrottleGroups.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/ThrottleGroups.java Sat Dec 6 14:16:00 2014
@@ -16,9 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.throttler;
+package org.apache.manifoldcf.connectorcommon.throttler;
import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.connectorcommon.interfaces.*;
import java.util.*;
/** An implementation of IThrottleGroups, which establishes a JVM-wide
Modified: manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/Throttler.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/Throttler.java?rev=1643535&r1=1643193&r2=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/Throttler.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/throttler/Throttler.java Sat Dec 6 14:16:00 2014
@@ -16,9 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.throttler;
+package org.apache.manifoldcf.connectorcommon.throttler;
import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.connectorcommon.interfaces.*;
import java.util.*;
import java.util.concurrent.atomic.*;
Modified: manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/throttler/TestThrottler.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/throttler/TestThrottler.java?rev=1643535&r1=1643193&r2=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/throttler/TestThrottler.java (original)
+++ manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/throttler/TestThrottler.java Sat Dec 6 14:16:00 2014
@@ -16,9 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.manifoldcf.core.throttler;
+package org.apache.manifoldcf.connectorcommon.throttler;
import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.connectorcommon.interfaces.*;
import java.io.*;
import java.util.*;
import java.util.concurrent.atomic.*;
Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java?rev=1643535&r1=1643534&r2=1643535&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java Sat Dec 6 14:16:00 2014
@@ -19,6 +19,7 @@
package org.apache.manifoldcf.core.system;
import org.apache.manifoldcf.core.interfaces.*;
+import java.lang.reflect.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;
@@ -289,9 +290,8 @@ public class ManifoldCF
masterDatabaseUsername = LockManagerFactory.getStringProperty(threadContext,masterDatabaseUsernameProperty,"manifoldcf");
masterDatabasePassword = LockManagerFactory.getPossiblyObfuscatedStringProperty(threadContext,masterDatabasePasswordProperty,"local_pg_passwd");
- // Register the throttler
- addShutdownHook(new ThrottlerShutdown());
- addPollingHook(new ThrottlerPoll());
+ // Register the connector services
+ registerConnectorServices();
// Put the cache manager in the polling loop
addPollingHook(new CachePoll());
@@ -314,6 +314,41 @@ public class ManifoldCF
}
}
+
+ /** Register connector services provided in connectors and connector-commons
+ */
+ protected static void registerConnectorServices()
+ throws ManifoldCFException
+ {
+ try
+ {
+ Class connectorServicesManifoldCF = findClass("org.apache.manifoldcf.connectorcommon.system.ManifoldCF");
+ Method m = connectorServicesManifoldCF.getMethod("registerConnectorServices",new Class[0]);
+ m.invoke(new Object[0]);
+ }
+ catch (ClassNotFoundException e)
+ {
+ Logging.root.warn("Could not find connectorcommon main class: "+e.getMessage(),e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ Logging.root.warn("ManifoldCF.registerConnectorServices not found: "+e.getMessage(),e);
+ }
+ catch (IllegalAccessException e)
+ {
+ Logging.root.warn("Connectorcommon main class had illegal access: "+e.getMessage(),e);
+ }
+ catch (InvocationTargetException e)
+ {
+ Throwable z = e.getTargetException();
+ if (z instanceof Error)
+ throw (Error)z;
+ else if (z instanceof RuntimeException)
+ throw (RuntimeException)z;
+ else
+ throw new RuntimeException("Unknown exception type: "+z.getClass().getName()+": "+z.getMessage(),z);
+ }
+ }
/** For local properties (not shared!!), this class allows them to be overridden directly from the command line.
*/
@@ -1597,53 +1632,6 @@ public class ManifoldCF
}
- /** Class that polls throttler */
- protected static class ThrottlerPoll implements IPollingHook
- {
- public ThrottlerPoll()
- {
- }
-
- @Override
- public void doPoll(IThreadContext threadContext)
- throws ManifoldCFException
- {
- IThrottleGroups connectionThrottler = ThrottleGroupsFactory.make(threadContext);
- connectionThrottler.poll();
- }
- }
-
- /** Class that cleans up throttler on exit */
- protected static class ThrottlerShutdown implements IShutdownHook
- {
- public ThrottlerShutdown()
- {
- }
-
- @Override
- public void doCleanup(IThreadContext threadContext)
- throws ManifoldCFException
- {
- IThrottleGroups connectionThrottler = ThrottleGroupsFactory.make(threadContext);
- connectionThrottler.destroy();
- }
-
- /** Finalizer, which is designed to catch class unloading that tomcat 5.5 does.
- */
- protected void finalize()
- throws Throwable
- {
- try
- {
- doCleanup(ThreadContextFactory.make());
- }
- finally
- {
- super.finalize();
- }
- }
-
- }
/** Class that cleans up expired cache objects on polling.
*/