Return-Path: Delivered-To: apmail-sling-commits-archive@www.apache.org Received: (qmail 61094 invoked from network); 6 Oct 2010 14:08:10 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Oct 2010 14:08:10 -0000 Received: (qmail 19789 invoked by uid 500); 6 Oct 2010 14:08:10 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 19751 invoked by uid 500); 6 Oct 2010 14:08:10 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 19743 invoked by uid 99); 6 Oct 2010 14:08:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Oct 2010 14:08:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Oct 2010 14:08:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DA8A723889BF; Wed, 6 Oct 2010 14:07:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1005046 - in /sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl: DefaultThreadPool.java DefaultThreadPoolManager.java ThreadPoolFacade.java WebConsolePrinter.java Date: Wed, 06 Oct 2010 14:07:45 -0000 To: commits@sling.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101006140745.DA8A723889BF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Wed Oct 6 14:07:45 2010 New Revision: 1005046 URL: http://svn.apache.org/viewvc?rev=1005046&view=rev Log: SLING-1820 : Display current pool statistics in web console Modified: sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPool.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/ThreadPoolFacade.java sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/WebConsolePrinter.java Modified: sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPool.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPool.java?rev=1005046&r1=1005045&r2=1005046&view=diff ============================================================================== --- sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPool.java (original) +++ sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPool.java Wed Oct 6 14:07:45 2010 @@ -199,4 +199,8 @@ public class DefaultThreadPool } this.logger.info("Thread pool [{}] is shut down.", this.name); } + + public ThreadPoolExecutor getExecutor() { + return this.executor; + } } 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=1005046&r1=1005045&r2=1005046&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 Wed Oct 6 14:07:45 2010 @@ -20,6 +20,7 @@ import java.util.Dictionary; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import java.util.concurrent.ThreadPoolExecutor; import org.apache.sling.commons.threads.ModifiableThreadPoolConfig; import org.apache.sling.commons.threads.ThreadPool; @@ -326,5 +327,12 @@ public class DefaultThreadPoolManager public ThreadPoolConfig getConfig() { return this.config; } + + public ThreadPoolExecutor getExecutor() { + if ( this.pool != null ) { + return this.pool.getExecutor(); + } + return null; + } } } Modified: sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/ThreadPoolFacade.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/ThreadPoolFacade.java?rev=1005046&r1=1005045&r2=1005046&view=diff ============================================================================== --- sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/ThreadPoolFacade.java (original) +++ sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/ThreadPoolFacade.java Wed Oct 6 14:07:45 2010 @@ -16,6 +16,8 @@ */ package org.apache.sling.commons.threads.impl; +import java.util.concurrent.ThreadPoolExecutor; + import org.apache.sling.commons.threads.ThreadPool; import org.apache.sling.commons.threads.ThreadPoolConfig; @@ -81,4 +83,8 @@ public final class ThreadPoolFacade impl this.delegatee = pool; oldPool.shutdown(); } + + public ThreadPoolExecutor getExecutor() { + return this.delegatee.getExecutor(); + } } 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=1005046&r1=1005045&r2=1005046&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 Wed Oct 6 14:07:45 2010 @@ -21,8 +21,10 @@ package org.apache.sling.commons.threads import java.io.PrintWriter; 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; import org.osgi.framework.ServiceRegistration; @@ -80,6 +82,7 @@ public class WebConsolePrinter implement final DefaultThreadPoolManager.Entry[] configs = this.mgr.getConfigurations(); if ( configs.length > 0 ) { for(final DefaultThreadPoolManager.Entry entry : configs ) { + final ThreadPoolConfig config = entry.getConfig(); pw.print("Pool "); pw.println(entry.getName()); if ( entry.getPid() != null ) { @@ -89,23 +92,40 @@ public class WebConsolePrinter implement pw.print("- used : "); pw.println(entry.isUsed()); pw.print("- min pool size : "); - pw.println(entry.getConfig().getMinPoolSize()); + pw.println(config.getMinPoolSize()); pw.print("- max pool size : "); - pw.println(entry.getConfig().getMaxPoolSize()); + pw.println(config.getMaxPoolSize()); pw.print("- queue size : "); - pw.println(entry.getConfig().getQueueSize()); + pw.println(config.getQueueSize()); pw.print("- keep alive time : "); - pw.println(entry.getConfig().getKeepAliveTime()); + pw.println(config.getKeepAliveTime()); pw.print("- block policy : "); - pw.println(entry.getConfig().getBlockPolicy()); + pw.println(config.getBlockPolicy()); pw.print("- priority : "); - pw.println(entry.getConfig().getPriority()); + pw.println(config.getPriority()); pw.print("- shutdown graceful : "); - pw.println(entry.getConfig().isShutdownGraceful()); + pw.println(config.isShutdownGraceful()); pw.print("- shutdown wait time : "); - pw.println(entry.getConfig().getShutdownWaitTimeMs()); + pw.println(config.getShutdownWaitTimeMs()); pw.print("- daemon : "); - pw.println(entry.getConfig().isDaemon()); + pw.println(config.isDaemon()); + final ThreadPoolExecutor tpe = entry.getExecutor(); + if ( tpe != null ) { + pw.print("- active count : "); + pw.println(tpe.getActiveCount()); + pw.print("- completed task count : "); + pw.println(tpe.getCompletedTaskCount()); + pw.print("- core pool size : "); + pw.println(tpe.getCorePoolSize()); + pw.print("- largest pool size : "); + pw.println(tpe.getLargestPoolSize()); + pw.print("- maximum pool size : "); + pw.println(tpe.getMaximumPoolSize()); + pw.print("- pool size : "); + pw.println(tpe.getPoolSize()); + pw.print("- task count : "); + pw.println(tpe.getTaskCount()); + } pw.println(); } } else {