This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.commons.threads-3.1.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-threads.git
commit 949956697f6f8168c09ccca59b7fc2ca15164d4e Author: Carsten Ziegeler <[email protected]> AuthorDate: Mon Oct 11 15:31:21 2010 +0000 SLING-1833 : Remove direct dependency to web console by using new configuration printer support git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/threads@1021386 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 9 --------- .../org/apache/sling/commons/threads/impl/Activator.java | 13 +++---------- .../commons/threads/impl/DefaultThreadPoolManager.java | 2 +- .../sling/commons/threads/impl/WebConsolePrinter.java | 14 ++++---------- 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index 7a25b7a..799d394 100644 --- a/pom.xml +++ b/pom.xml @@ -63,9 +63,6 @@ <Private-Package> org.apache.sling.commons.threads.impl </Private-Package> - <Import-Package> - org.apache.felix.webconsole;resolution:=optional, * - </Import-Package> </instructions> </configuration> </plugin> @@ -97,11 +94,5 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.webconsole</artifactId> - <version>3.0.0</version> - <scope>provided</scope> - </dependency> </dependencies> </project> diff --git a/src/main/java/org/apache/sling/commons/threads/impl/Activator.java b/src/main/java/org/apache/sling/commons/threads/impl/Activator.java index 1e76887..5bb85fe 100644 --- a/src/main/java/org/apache/sling/commons/threads/impl/Activator.java +++ b/src/main/java/org/apache/sling/commons/threads/impl/Activator.java @@ -54,22 +54,15 @@ public class Activator implements BundleActivator { this.service = new DefaultThreadPoolManager(this.bundleContext, props); this.serviceReg = this.bundleContext.registerService(new String[] {ThreadPoolManager.class.getName(), ManagedServiceFactory.class.getName()}, service, props); - try { - WebConsolePrinter.initPlugin(this.bundleContext, this.service); - } catch (Throwable ignore) { - // we just ignore this - } + + WebConsolePrinter.initPlugin(this.bundleContext, this.service); } /** * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) { - try { - WebConsolePrinter.destroyPlugin(); - } catch (Throwable ignore) { - // we just ignore this - } + WebConsolePrinter.destroyPlugin(); if ( this.serviceReg != null ) { this.serviceReg.unregister(); this.serviceReg = null; diff --git a/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java b/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java index e2cd301..3344313 100644 --- a/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java +++ b/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java @@ -189,7 +189,7 @@ public class DefaultThreadPoolManager /** * @see org.osgi.service.cm.ManagedServiceFactory#updated(java.lang.String, java.util.Dictionary) */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void updated(String pid, Dictionary properties) throws ConfigurationException { final String name = (String) properties.get(ModifiableThreadPoolConfig.PROPERTY_NAME); diff --git a/src/main/java/org/apache/sling/commons/threads/impl/WebConsolePrinter.java b/src/main/java/org/apache/sling/commons/threads/impl/WebConsolePrinter.java index 1e1d92e..c2f8eaa 100644 --- a/src/main/java/org/apache/sling/commons/threads/impl/WebConsolePrinter.java +++ b/src/main/java/org/apache/sling/commons/threads/impl/WebConsolePrinter.java @@ -23,7 +23,6 @@ import java.util.Dictionary; import java.util.Hashtable; import java.util.concurrent.ThreadPoolExecutor; -import org.apache.felix.webconsole.ConfigurationPrinter; import org.apache.sling.commons.threads.ThreadPoolConfig; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; @@ -34,7 +33,7 @@ import org.osgi.framework.ServiceRegistration; * prints out the thread pools. * */ -public class WebConsolePrinter implements ConfigurationPrinter { +public class WebConsolePrinter { private static ServiceRegistration plugin; @@ -46,8 +45,10 @@ public class WebConsolePrinter implements ConfigurationPrinter { "Apache Sling Thread Pool Configuration Printer"); props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation"); props.put("felix.webconsole.label", "slingthreadpools"); + props.put("felix.webconsole.title", "Sling Thread Pools"); + props.put("felix.webconsole.configprinter.modes", "always"); - plugin = bundleContext.registerService(ConfigurationPrinter.class.getName(), + plugin = bundleContext.registerService(WebConsolePrinter.class.getName(), propertiesPrinter, props); } @@ -67,13 +68,6 @@ public class WebConsolePrinter implements ConfigurationPrinter { } /** - * @see org.apache.felix.webconsole.ConfigurationPrinter#getTitle() - */ - public String getTitle() { - return "Sling Thread Pools"; - } - - /** * Print out the servlet filter chains. * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter) */ -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
