You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2010/10/11 17:31:21 UTC

svn commit: r1021386 - in /sling/trunk/bundles/commons/threads: ./ src/main/java/org/apache/sling/commons/threads/impl/

Author: cziegeler
Date: Mon Oct 11 15:31:21 2010
New Revision: 1021386

URL: http://svn.apache.org/viewvc?rev=1021386&view=rev
Log:
SLING-1833 : Remove direct dependency to web console by using new configuration printer support

Modified:
    sling/trunk/bundles/commons/threads/pom.xml
    sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/Activator.java
    sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java
    sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/WebConsolePrinter.java

Modified: sling/trunk/bundles/commons/threads/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/threads/pom.xml?rev=1021386&r1=1021385&r2=1021386&view=diff
==============================================================================
--- sling/trunk/bundles/commons/threads/pom.xml (original)
+++ sling/trunk/bundles/commons/threads/pom.xml Mon Oct 11 15:31:21 2010
@@ -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>

Modified: sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/Activator.java?rev=1021386&r1=1021385&r2=1021386&view=diff
==============================================================================
--- sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/Activator.java (original)
+++ sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/Activator.java Mon Oct 11 15:31:21 2010
@@ -54,22 +54,15 @@ public class Activator implements Bundle
         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;

Modified: sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java?rev=1021386&r1=1021385&r2=1021386&view=diff
==============================================================================
--- sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java (original)
+++ sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java Mon Oct 11 15:31:21 2010
@@ -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);

Modified: sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/WebConsolePrinter.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/WebConsolePrinter.java?rev=1021386&r1=1021385&r2=1021386&view=diff
==============================================================================
--- sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/WebConsolePrinter.java (original)
+++ sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/WebConsolePrinter.java Mon Oct 11 15:31:21 2010
@@ -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.ServiceRegistr
  * prints out the thread pools.
  *
  */
-public class WebConsolePrinter implements ConfigurationPrinter {
+public class WebConsolePrinter {
 
     private static ServiceRegistration plugin;
 
@@ -46,8 +45,10 @@ public class WebConsolePrinter implement
             "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 implement
     }
 
     /**
-     * @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)
      */