geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r392847 - in /geronimo/branches/1.1: configs/client/src/plan/ configs/j2ee-server/src/plan/ modules/connector-builder/ modules/connector-builder/src/test-data/connector_1_5/ modules/connector-builder/src/test-data/data/ modules/connector/ m...
Date Sun, 09 Apr 2006 22:58:41 GMT
Author: ammulder
Date: Sun Apr  9 15:58:39 2006
New Revision: 392847

URL: http://svn.apache.org/viewcvs?rev=392847&view=rev
Log:
Make thread pools manageable and make our WorkManager use our thread pools
  under the covers.

Added:
    geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/ThreadPool.java
    geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/stats/ThreadPoolStats.java
Modified:
    geronimo/branches/1.1/configs/client/src/plan/plan.xml
    geronimo/branches/1.1/configs/j2ee-server/src/plan/plan.xml
    geronimo/branches/1.1/modules/connector-builder/project.xml
    geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/geronimo-ra.xml
    geronimo/branches/1.1/modules/connector-builder/src/test-data/data/external-application-plan.xml
    geronimo/branches/1.1/modules/connector-builder/src/test-data/data/old-schema-plan.xml
    geronimo/branches/1.1/modules/connector/project.xml
    geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java
    geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java
    geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/ScheduleWorkExecutor.java
    geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/StartWorkExecutor.java
    geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/SyncWorkExecutor.java
    geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/WorkExecutor.java
    geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/BootstrapContextTest.java
    geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/work/PooledWorkManagerTest.java
    geronimo/branches/1.1/modules/core/project.xml
    geronimo/branches/1.1/modules/core/src/java/org/apache/geronimo/pool/GeronimoExecutor.java
    geronimo/branches/1.1/modules/core/src/java/org/apache/geronimo/pool/ThreadPool.java
    geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
    geronimo/branches/1.1/modules/management/project.xml
    geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java
    geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/stats/StatsImpl.java
    geronimo/branches/1.1/modules/timer/project.xml

Modified: geronimo/branches/1.1/configs/client/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/client/src/plan/plan.xml?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/client/src/plan/plan.xml (original)
+++ geronimo/branches/1.1/configs/client/src/plan/plan.xml Sun Apr  9 15:58:39 2006
@@ -48,9 +48,15 @@
     </gbean>
 
     <gbean name="DefaultWorkManager"  class="org.apache.geronimo.connector.work.GeronimoWorkManagerGBean">
-        <attribute name="syncMaximumPoolSize">10</attribute>
-        <attribute name="startMaximumPoolSize">10</attribute>
-        <attribute name="scheduledMaximumPoolSize">10</attribute>
+        <reference name="SyncPool">
+            <name>DefaultThreadPool</name>
+        </reference>
+        <reference name="StartPool">
+            <name>DefaultThreadPool</name>
+        </reference>
+        <reference name="ScheduledPool">
+            <name>DefaultThreadPool</name>
+        </reference>
         <reference name="TransactionContextManager">
             <name>TransactionContextManager</name>
         </reference>

Modified: geronimo/branches/1.1/configs/j2ee-server/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/j2ee-server/src/plan/plan.xml?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/j2ee-server/src/plan/plan.xml (original)
+++ geronimo/branches/1.1/configs/j2ee-server/src/plan/plan.xml Sun Apr  9 15:58:39 2006
@@ -41,10 +41,22 @@
            class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean">
     </gbean>
 
+    <gbean name="ConnectorThreadPool" class="org.apache.geronimo.pool.ThreadPool">
+        <attribute name="keepAliveTime">5000</attribute>
+        <attribute name="poolSize">30</attribute>
+        <attribute name="poolName">ConnectorThreadPool</attribute>
+    </gbean>
+
     <gbean name="DefaultWorkManager" class="org.apache.geronimo.connector.work.GeronimoWorkManagerGBean">
-        <attribute name="syncMaximumPoolSize">10</attribute>
-        <attribute name="startMaximumPoolSize">10</attribute>
-        <attribute name="scheduledMaximumPoolSize">10</attribute>
+        <reference name="SyncPool">
+            <name>ConnectorThreadPool</name>
+        </reference>
+        <reference name="StartPool">
+            <name>ConnectorThreadPool</name>
+        </reference>
+        <reference name="ScheduledPool">
+            <name>ConnectorThreadPool</name>
+        </reference>
         <reference name="TransactionContextManager">
             <name>TransactionContextManager</name>
         </reference>

Modified: geronimo/branches/1.1/modules/connector-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/project.xml?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/project.xml (original)
+++ geronimo/branches/1.1/modules/connector-builder/project.xml Sun Apr  9 15:58:39 2006
@@ -111,6 +111,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+            <version>${geronimo_spec_j2ee_management_version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-management</artifactId>
             <version>${pom.currentVersion}</version>

Modified: geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/geronimo-ra.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/geronimo-ra.xml?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/geronimo-ra.xml (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/geronimo-ra.xml Sun Apr  9 15:58:39 2006
@@ -113,10 +113,22 @@
            class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean">
     </gbean>
 
+    <gbean name="DefaultThreadPool" class="org.apache.geronimo.pool.ThreadPool">
+        <attribute name="keepAliveTime">5000</attribute>
+        <attribute name="poolSize">300</attribute>
+        <attribute name="poolName">DefaultThreadPool</attribute>
+    </gbean>
+
     <gbean name="DefaultWorkManager" class="org.apache.geronimo.connector.work.GeronimoWorkManagerGBean">
-        <attribute name="syncMaximumPoolSize">10</attribute>
-        <attribute name="startMaximumPoolSize">10</attribute>
-        <attribute name="scheduledMaximumPoolSize">10</attribute>
+        <reference name="SyncPool">
+            <name>DefaultThreadPool</name>
+        </reference>
+        <reference name="StartPool">
+            <name>DefaultThreadPool</name>
+        </reference>
+        <reference name="ScheduledPool">
+            <name>DefaultThreadPool</name>
+        </reference>
         <reference name="TransactionContextManager">
             <name>TransactionContextManager</name>
         </reference>

Modified: geronimo/branches/1.1/modules/connector-builder/src/test-data/data/external-application-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test-data/data/external-application-plan.xml?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test-data/data/external-application-plan.xml (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test-data/data/external-application-plan.xml Sun Apr  9 15:58:39 2006
@@ -191,11 +191,25 @@
     <gbean name="ConnectionTracker" class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean">
     </gbean>
 
+    <gbean name="DefaultThreadPool" class="org.apache.geronimo.pool.ThreadPool">
+        <attribute name="keepAliveTime">5000</attribute>
+        <attribute name="poolSize">300</attribute>
+        <attribute name="poolName">DefaultThreadPool</attribute>
+    </gbean>
+
     <gbean name="DefaultWorkManager" class="org.apache.geronimo.connector.work.GeronimoWorkManagerGBean">
-        <attribute name="syncMaximumPoolSize">10</attribute>
-        <attribute name="startMaximumPoolSize">10</attribute>
-        <attribute name="scheduledMaximumPoolSize">10</attribute>
-        <reference name="TransactionContextManager"><name>TransactionContextManager</name></reference>
+        <reference name="SyncPool">
+            <name>DefaultThreadPool</name>
+        </reference>
+        <reference name="StartPool">
+            <name>DefaultThreadPool</name>
+        </reference>
+        <reference name="ScheduledPool">
+            <name>DefaultThreadPool</name>
+        </reference>
+        <reference name="TransactionContextManager">
+            <name>TransactionContextManager</name>
+        </reference>
     </gbean>
 
     <gbean name="TransactionManager" class="org.apache.geronimo.transaction.manager.TransactionManagerImplGBean">

Modified: geronimo/branches/1.1/modules/connector-builder/src/test-data/data/old-schema-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test-data/data/old-schema-plan.xml?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test-data/data/old-schema-plan.xml (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test-data/data/old-schema-plan.xml Sun Apr  9 15:58:39 2006
@@ -110,11 +110,25 @@
     <gbean name="ConnectionTracker" class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean">
     </gbean>
 
+    <gbean name="DefaultThreadPool" class="org.apache.geronimo.pool.ThreadPool">
+        <attribute name="keepAliveTime">5000</attribute>
+        <attribute name="poolSize">300</attribute>
+        <attribute name="poolName">DefaultThreadPool</attribute>
+    </gbean>
+
     <gbean name="DefaultWorkManager" class="org.apache.geronimo.connector.work.GeronimoWorkManagerGBean">
-        <attribute name="syncMaximumPoolSize">10</attribute>
-        <attribute name="startMaximumPoolSize">10</attribute>
-        <attribute name="scheduledMaximumPoolSize">10</attribute>
-        <reference name="TransactionContextManager"><name>TransactionContextManager</name></reference>
+        <reference name="SyncPool">
+            <name>DefaultThreadPool</name>
+        </reference>
+        <reference name="StartPool">
+            <name>DefaultThreadPool</name>
+        </reference>
+        <reference name="ScheduledPool">
+            <name>DefaultThreadPool</name>
+        </reference>
+        <reference name="TransactionContextManager">
+            <name>TransactionContextManager</name>
+        </reference>
     </gbean>
 
     <gbean name="TransactionManager" class="org.apache.geronimo.transaction.manager.TransactionManagerImplGBean">

Modified: geronimo/branches/1.1/modules/connector/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/project.xml?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/project.xml (original)
+++ geronimo/branches/1.1/modules/connector/project.xml Sun Apr  9 15:58:39 2006
@@ -56,8 +56,20 @@
 
         <dependency>
             <groupId>geronimo</groupId>
+            <artifactId>geronimo-core</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
             <artifactId>geronimo-j2ee</artifactId>
             <version>${pom.currentVersion}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+            <version>${geronimo_spec_j2ee_management_version}</version>
         </dependency>
 
         <dependency>

Modified: geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java (original)
+++ geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java Sun Apr  9 15:58:39 2006
@@ -17,15 +17,6 @@
 
 package org.apache.geronimo.connector.work;
 
-import EDU.oswego.cs.dl.util.concurrent.Executor;
-import org.apache.geronimo.connector.work.pool.NullWorkExecutorPool;
-import org.apache.geronimo.connector.work.pool.ScheduleWorkExecutor;
-import org.apache.geronimo.connector.work.pool.StartWorkExecutor;
-import org.apache.geronimo.connector.work.pool.SyncWorkExecutor;
-import org.apache.geronimo.connector.work.pool.WorkExecutor;
-import org.apache.geronimo.connector.work.pool.WorkExecutorPool;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
-
 import javax.resource.spi.XATerminator;
 import javax.resource.spi.work.ExecutionContext;
 import javax.resource.spi.work.Work;
@@ -33,6 +24,12 @@
 import javax.resource.spi.work.WorkException;
 import javax.resource.spi.work.WorkListener;
 import javax.resource.spi.work.WorkManager;
+import org.apache.geronimo.connector.work.pool.ScheduleWorkExecutor;
+import org.apache.geronimo.connector.work.pool.StartWorkExecutor;
+import org.apache.geronimo.connector.work.pool.SyncWorkExecutor;
+import org.apache.geronimo.connector.work.pool.WorkExecutor;
+import org.apache.geronimo.pool.GeronimoExecutor;
+import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 /**
  * WorkManager implementation which uses under the cover three WorkExecutorPool
@@ -46,25 +43,25 @@
  */
 public class GeronimoWorkManager implements WorkManager {
 
-    private final static int DEFAULT_POOL_SIZE = 10;
+//    private final static int DEFAULT_POOL_SIZE = 10;
 
     /**
      * Pool of threads used by this WorkManager in order to process
      * the Work instances submitted via the doWork methods.
      */
-    private WorkExecutorPool syncWorkExecutorPool;
+    private GeronimoExecutor syncWorkExecutorPool;
 
     /**
      * Pool of threads used by this WorkManager in order to process
      * the Work instances submitted via the startWork methods.
      */
-    private WorkExecutorPool startWorkExecutorPool;
+    private GeronimoExecutor startWorkExecutorPool;
 
     /**
      * Pool of threads used by this WorkManager in order to process
      * the Work instances submitted via the scheduleWork methods.
      */
-    private WorkExecutorPool scheduledWorkExecutorPool;
+    private GeronimoExecutor scheduledWorkExecutorPool;
 
     private final TransactionContextManager transactionContextManager;
 
@@ -76,30 +73,20 @@
      * Create a WorkManager.
      */
     public GeronimoWorkManager() {
-        this(DEFAULT_POOL_SIZE, null);
-    }
-
-    public GeronimoWorkManager(int size, TransactionContextManager transactionContextManager) {
-        this(size, size, size, transactionContextManager);
+        this(null, null, null, null);
     }
 
-    public GeronimoWorkManager(int syncSize, int startSize, int schedSize, TransactionContextManager transactionContextManager) {
-        syncWorkExecutorPool = new NullWorkExecutorPool(syncSize);
-        startWorkExecutorPool = new NullWorkExecutorPool(startSize);
-        scheduledWorkExecutorPool = new NullWorkExecutorPool(schedSize);
+    public GeronimoWorkManager(GeronimoExecutor sync, GeronimoExecutor start, GeronimoExecutor sched, TransactionContextManager transactionContextManager) {
+        syncWorkExecutorPool = sync;
+        startWorkExecutorPool = start;
+        scheduledWorkExecutorPool = sched;
         this.transactionContextManager = transactionContextManager;
     }
 
     public void doStart() throws Exception {
-        syncWorkExecutorPool = syncWorkExecutorPool.start();
-        startWorkExecutorPool = startWorkExecutorPool.start();
-        scheduledWorkExecutorPool = scheduledWorkExecutorPool.start();
     }
 
     public void doStop() throws Exception {
-        syncWorkExecutorPool = syncWorkExecutorPool.stop();
-        startWorkExecutorPool = startWorkExecutorPool.stop();
-        scheduledWorkExecutorPool = scheduledWorkExecutorPool.stop();
     }
 
     public void doFail() {
@@ -114,40 +101,16 @@
         return transactionContextManager;
     }
 
-    public int getSyncThreadCount() {
-        return syncWorkExecutorPool.getPoolSize();
-    }
-
-    public int getSyncMaximumPoolSize() {
-        return syncWorkExecutorPool.getMaximumPoolSize();
-    }
-
-    public void setSyncMaximumPoolSize(int maxSize) {
-        syncWorkExecutorPool.setMaximumPoolSize(maxSize);
-    }
-
-    public int getStartThreadCount() {
-        return startWorkExecutorPool.getPoolSize();
-    }
-
-    public int getStartMaximumPoolSize() {
-        return startWorkExecutorPool.getMaximumPoolSize();
-    }
-
-    public void setStartMaximumPoolSize(int maxSize) {
-        startWorkExecutorPool.setMaximumPoolSize(maxSize);
-    }
-
-    public int getScheduledThreadCount() {
-        return scheduledWorkExecutorPool.getPoolSize();
+    public GeronimoExecutor getSyncWorkExecutorPool() {
+        return syncWorkExecutorPool;
     }
 
-    public int getScheduledMaximumPoolSize() {
-        return scheduledWorkExecutorPool.getMaximumPoolSize();
+    public GeronimoExecutor getStartWorkExecutorPool() {
+        return startWorkExecutorPool;
     }
 
-    public void setScheduledMaximumPoolSize(int maxSize) {
-        scheduledWorkExecutorPool.setMaximumPoolSize(maxSize);
+    public GeronimoExecutor getScheduledWorkExecutorPool() {
+        return scheduledWorkExecutorPool;
     }
 
     /* (non-Javadoc)
@@ -230,7 +193,7 @@
      * @exception WorkException Indicates that the Work execution has been
      * unsuccessful.
      */
-    private void executeWork(WorkerContext work, WorkExecutor workExecutor, Executor pooledExecutor) throws WorkException {
+    private void executeWork(WorkerContext work, WorkExecutor workExecutor, GeronimoExecutor pooledExecutor) throws WorkException {
         work.workAccepted(this);
         try {
             workExecutor.doExecute(work, pooledExecutor);

Modified: geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java (original)
+++ geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java Sun Apr  9 15:58:39 2006
@@ -17,12 +17,11 @@
 
 package org.apache.geronimo.connector.work;
 
-import javax.resource.spi.work.WorkManager;
-
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.pool.GeronimoExecutor;
 import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 /**
@@ -34,12 +33,8 @@
     public GeronimoWorkManagerGBean() {
     }
 
-    public GeronimoWorkManagerGBean(int size, TransactionContextManager transactionContextManager) {
-        super(size, transactionContextManager);
-    }
-
-    public GeronimoWorkManagerGBean(int syncSize, int startSize, int schedSize, TransactionContextManager transactionContextManager) {
-        super(syncSize, startSize, schedSize, transactionContextManager);
+    public GeronimoWorkManagerGBean(GeronimoExecutor sync, GeronimoExecutor start, GeronimoExecutor sched, TransactionContextManager transactionContextManager) {
+        super(sync, start, sched, transactionContextManager);
     }
 
     public static final GBeanInfo GBEAN_INFO;
@@ -48,18 +43,18 @@
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(GeronimoWorkManagerGBean.class, NameFactory.JCA_WORK_MANAGER);
         infoFactory.addInterface(GeronimoWorkManager.class);
 
-        infoFactory.addAttribute("syncMaximumPoolSize", Integer.TYPE, true);
-        infoFactory.addAttribute("startMaximumPoolSize", Integer.TYPE, true);
-        infoFactory.addAttribute("scheduledMaximumPoolSize", Integer.TYPE, true);
+        infoFactory.addReference("SyncPool", GeronimoExecutor.class, NameFactory.GERONIMO_SERVICE);
+        infoFactory.addReference("StartPool", GeronimoExecutor.class, NameFactory.GERONIMO_SERVICE);
+        infoFactory.addReference("ScheduledPool", GeronimoExecutor.class, NameFactory.GERONIMO_SERVICE);
 
         infoFactory.addOperation("getXATerminator");
 
         infoFactory.addReference("TransactionContextManager", TransactionContextManager.class, NameFactory.TRANSACTION_CONTEXT_MANAGER);
 
         infoFactory.setConstructor(new String[]{
-            "syncMaximumPoolSize",
-            "startMaximumPoolSize",
-            "scheduledMaximumPoolSize",
+            "SyncPool",
+            "StartPool",
+            "ScheduledPool",
             "TransactionContextManager"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();

Modified: geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/ScheduleWorkExecutor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/ScheduleWorkExecutor.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/ScheduleWorkExecutor.java (original)
+++ geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/ScheduleWorkExecutor.java Sun Apr  9 15:58:39 2006
@@ -18,9 +18,8 @@
 package org.apache.geronimo.connector.work.pool;
 
 import javax.resource.spi.work.WorkException;
-
 import org.apache.geronimo.connector.work.WorkerContext;
-import EDU.oswego.cs.dl.util.concurrent.Executor;
+import org.apache.geronimo.pool.GeronimoExecutor;
 
 /**
  *
@@ -30,8 +29,8 @@
  * */
 public class ScheduleWorkExecutor implements WorkExecutor {
 
-    public void doExecute(WorkerContext work, Executor executor)
+    public void doExecute(WorkerContext work, GeronimoExecutor executor)
             throws WorkException, InterruptedException {
-        executor.execute(work);
+        executor.execute("A J2EE Connector", work);
     }
 }

Modified: geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/StartWorkExecutor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/StartWorkExecutor.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/StartWorkExecutor.java (original)
+++ geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/StartWorkExecutor.java Sun Apr  9 15:58:39 2006
@@ -18,10 +18,9 @@
 package org.apache.geronimo.connector.work.pool;
 
 import javax.resource.spi.work.WorkException;
-
-import org.apache.geronimo.connector.work.WorkerContext;
-import EDU.oswego.cs.dl.util.concurrent.Executor;
 import EDU.oswego.cs.dl.util.concurrent.Latch;
+import org.apache.geronimo.connector.work.WorkerContext;
+import org.apache.geronimo.pool.GeronimoExecutor;
 
 /**
  *
@@ -31,10 +30,10 @@
  * */
 public class StartWorkExecutor implements WorkExecutor {
 
-    public void doExecute(WorkerContext work, Executor executor)
+    public void doExecute(WorkerContext work, GeronimoExecutor executor)
             throws WorkException, InterruptedException {
         Latch latch = work.provideStartLatch();
-        executor.execute(work);
+        executor.execute("A J2EE Connector", work);
         latch.acquire();
     }
 }

Modified: geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/SyncWorkExecutor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/SyncWorkExecutor.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/SyncWorkExecutor.java (original)
+++ geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/SyncWorkExecutor.java Sun Apr  9 15:58:39 2006
@@ -18,10 +18,9 @@
 package org.apache.geronimo.connector.work.pool;
 
 import javax.resource.spi.work.WorkException;
-
-import org.apache.geronimo.connector.work.WorkerContext;
-import EDU.oswego.cs.dl.util.concurrent.Executor;
 import EDU.oswego.cs.dl.util.concurrent.Latch;
+import org.apache.geronimo.connector.work.WorkerContext;
+import org.apache.geronimo.pool.GeronimoExecutor;
 
 /**
  *
@@ -31,10 +30,10 @@
  * */
 public class SyncWorkExecutor implements WorkExecutor {
 
-    public void doExecute(WorkerContext work, Executor executor)
+    public void doExecute(WorkerContext work, GeronimoExecutor executor)
             throws WorkException, InterruptedException {
         Latch latch = work.provideEndLatch();
-        executor.execute(work);
+        executor.execute("A J2EE Connector", work);
         latch.acquire();
     }
 }

Modified: geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/WorkExecutor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/WorkExecutor.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/WorkExecutor.java (original)
+++ geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/work/pool/WorkExecutor.java Sun Apr  9 15:58:39 2006
@@ -1,9 +1,8 @@
 package org.apache.geronimo.connector.work.pool;
 
 import javax.resource.spi.work.WorkException;
-
 import org.apache.geronimo.connector.work.WorkerContext;
-import EDU.oswego.cs.dl.util.concurrent.Executor;
+import org.apache.geronimo.pool.GeronimoExecutor;
 
 /**
  *
@@ -24,7 +23,7 @@
      * @throws InterruptedException Indicates that the thread in charge of the
      * execution of the specified work has been interrupted.
      */
-     void doExecute(WorkerContext work, Executor executor)
+     void doExecute(WorkerContext work, GeronimoExecutor executor)
             throws WorkException, InterruptedException;
 
 

Modified: geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/BootstrapContextTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/BootstrapContextTest.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/BootstrapContextTest.java (original)
+++ geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/BootstrapContextTest.java Sun Apr  9 15:58:39 2006
@@ -24,19 +24,25 @@
 import junit.framework.TestCase;
 import org.apache.geronimo.connector.work.GeronimoWorkManager;
 import org.apache.geronimo.transaction.context.TransactionContextManager;
+import org.apache.geronimo.pool.ThreadPool;
 
 /**
  * Unit tests for {@link BootstrapContextImpl}
  * @version $Rev$ $Date$
  */
 public class BootstrapContextTest extends TestCase {
+    ThreadPool pool;
+    protected void setUp() throws Exception {
+        super.setUp();
+        pool = new ThreadPool(1, "Connector Test", 30000, ThreadPool.class.getClassLoader(), "foo:test=bar");
+    }
 
     /**
      * Tests get and set work manager
      */
     public void testGetSetWorkManager() {
         TransactionContextManager transactionContextManager = new TransactionContextManager();
-        GeronimoWorkManager manager = new GeronimoWorkManager(1, transactionContextManager);
+        GeronimoWorkManager manager = new GeronimoWorkManager(pool, pool, pool, transactionContextManager);
         BootstrapContextImpl context = new BootstrapContextImpl(manager);
         WorkManager wm = context.getWorkManager();
 
@@ -48,7 +54,7 @@
      */
     public void testGetSetXATerminator() {
         TransactionContextManager transactionContextManager = new TransactionContextManager();
-        GeronimoWorkManager manager = new GeronimoWorkManager(1, transactionContextManager);
+        GeronimoWorkManager manager = new GeronimoWorkManager(pool, pool, pool, transactionContextManager);
         BootstrapContextImpl context = new BootstrapContextImpl(manager);
         XATerminator xat = context.getXATerminator();
 

Modified: geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/work/PooledWorkManagerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/work/PooledWorkManagerTest.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/work/PooledWorkManagerTest.java (original)
+++ geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/work/PooledWorkManagerTest.java Sun Apr  9 15:58:39 2006
@@ -26,6 +26,7 @@
 
 import junit.framework.TestCase;
 import org.apache.geronimo.transaction.context.TransactionContextManager;
+import org.apache.geronimo.pool.ThreadPool;
 
 /**
  * Timing is crucial for this test case, which focuses on the synchronization
@@ -39,7 +40,9 @@
 
     protected void setUp() throws Exception {
         TransactionContextManager transactionContextManager = new TransactionContextManager();
-        workManager = new GeronimoWorkManager(1, transactionContextManager);
+        ThreadPool pool = new ThreadPool(1, "Connector Test", 30000, ThreadPool.class.getClassLoader(), "foo:test=bar");
+        pool.setWaitWhenBlocked(true);
+        workManager = new GeronimoWorkManager(pool, pool, pool, transactionContextManager);
         workManager.doStart();
     }
 
@@ -113,7 +116,7 @@
     }
 
     private AbstractDummyWork[] helperTest(Class aWork, int nbThreads,
-        int aTimeOut, int aTempo)
+                                           int aTimeOut, int aTempo)
         throws Exception {
         Constructor constructor = aWork.getConstructor(
             new Class[]{PooledWorkManagerTest.class, String.class,
@@ -154,9 +157,9 @@
         }
 
         protected abstract void perform(Work work,
-                long startTimeout,
-                ExecutionContext execContext,
-                WorkListener workListener) throws Exception;
+                                        long startTimeout,
+                                        ExecutionContext execContext,
+                                        WorkListener workListener) throws Exception;
     }
 
     public class DummyDoWork extends AbstractDummyWork {
@@ -165,9 +168,9 @@
         }
 
         protected void perform(Work work,
-                long startTimeout,
-                ExecutionContext execContext,
-                WorkListener workListener) throws Exception {
+                               long startTimeout,
+                               ExecutionContext execContext,
+                               WorkListener workListener) throws Exception {
             workManager.doWork(work, startTimeout, execContext, workListener);
         }
     }
@@ -178,9 +181,9 @@
         }
 
         protected void perform(Work work,
-                long startTimeout,
-                ExecutionContext execContext,
-                WorkListener workListener) throws Exception {
+                               long startTimeout,
+                               ExecutionContext execContext,
+                               WorkListener workListener) throws Exception {
             workManager.startWork(work, startTimeout, execContext, workListener);
         }
     }
@@ -191,9 +194,9 @@
         }
 
         protected void perform(Work work,
-                long startTimeout,
-                ExecutionContext execContext,
-                WorkListener workListener) throws Exception {
+                               long startTimeout,
+                               ExecutionContext execContext,
+                               WorkListener workListener) throws Exception {
             workManager.scheduleWork(work, startTimeout, execContext, workListener);
         }
     }

Modified: geronimo/branches/1.1/modules/core/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/core/project.xml?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/core/project.xml (original)
+++ geronimo/branches/1.1/modules/core/project.xml Sun Apr  9 15:58:39 2006
@@ -62,6 +62,18 @@
             <artifactId>geronimo-kernel</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-management</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+            <version>${geronimo_spec_j2ee_management_version}</version>
+        </dependency>
     </dependencies>
 
 

Modified: geronimo/branches/1.1/modules/core/src/java/org/apache/geronimo/pool/GeronimoExecutor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/core/src/java/org/apache/geronimo/pool/GeronimoExecutor.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/core/src/java/org/apache/geronimo/pool/GeronimoExecutor.java (original)
+++ geronimo/branches/1.1/modules/core/src/java/org/apache/geronimo/pool/GeronimoExecutor.java Sun Apr  9 15:58:39 2006
@@ -24,7 +24,7 @@
  *
  * @version $Rev$ $Date$
  */
-public interface GeronimoExecutor extends Executor {
+public interface GeronimoExecutor extends Executor, org.apache.geronimo.management.geronimo.ThreadPool {
     /**
      * Gets a human-readable name identifying this object.
      */

Modified: geronimo/branches/1.1/modules/core/src/java/org/apache/geronimo/pool/ThreadPool.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/core/src/java/org/apache/geronimo/pool/ThreadPool.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/core/src/java/org/apache/geronimo/pool/ThreadPool.java (original)
+++ geronimo/branches/1.1/modules/core/src/java/org/apache/geronimo/pool/ThreadPool.java Sun Apr  9 15:58:39 2006
@@ -17,22 +17,41 @@
 
 package org.apache.geronimo.pool;
 
-import javax.management.ObjectName;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
 import javax.management.MalformedObjectNameException;
-import EDU.oswego.cs.dl.util.concurrent.Executor;
+import javax.management.ObjectName;
+import javax.management.j2ee.statistics.BoundedRangeStatistic;
+import javax.management.j2ee.statistics.CountStatistic;
+import javax.management.j2ee.statistics.Stats;
 import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
 import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.management.J2EEManagedObject;
+import org.apache.geronimo.management.StatisticsProvider;
+import org.apache.geronimo.management.geronimo.stats.ThreadPoolStats;
+import org.apache.geronimo.management.stats.BoundedRangeImpl;
+import org.apache.geronimo.management.stats.CountStatisticImpl;
+import org.apache.geronimo.management.stats.StatsImpl;
 
 /**
  * @version $Rev$ $Date$
  */
-public class ThreadPool implements GeronimoExecutor, GBeanLifecycle {
+public class ThreadPool implements GeronimoExecutor, GBeanLifecycle, J2EEManagedObject, StatisticsProvider {
     private PooledExecutor executor;
     private ClassLoader classLoader;
     private ObjectName objectName;
+    private boolean waitWhenBlocked;
+
+    // Statistics-related fields follow
+    private boolean statsActive = true;
+    private PoolStatsImpl stats = new PoolStatsImpl();
+    private Map clients = new HashMap();
+
 
     public ThreadPool(int poolSize, String poolName, long keepAliveTime, ClassLoader classLoader, String objectName) {
         PooledExecutor p = new PooledExecutor(poolSize);
@@ -43,7 +62,7 @@
         try {
             this.objectName = ObjectName.getInstance(objectName);
         } catch (MalformedObjectNameException e) {
-            throw new IllegalStateException("Bad object name injected: "+e.getMessage());
+            throw new IllegalStateException("Bad object name injected: " + e.getMessage());
         }
 
         executor = p;
@@ -58,9 +77,110 @@
         return objectName.getCanonicalName();
     }
 
+    public boolean isEventProvider() {
+        return true;
+    }
+
+    public boolean isStateManageable() {
+        return true;
+    }
+
+    public boolean isStatisticsProvider() {
+        return true;
+    }
+
+    public Stats getStats() {
+        stats.threadsInUse.setLowerBound(0);
+        stats.threadsInUse.setUpperBound(executor.getMaximumPoolSize());
+        int inUse = executor.getPoolSize();
+        stats.threadsInUse.setCurrent(inUse);
+        if (inUse < stats.threadsInUse.getLowWaterMark()) {
+            stats.threadsInUse.setLowWaterMark(inUse);
+        }
+        if (inUse > stats.threadsInUse.getHighWaterMark()) {
+            stats.threadsInUse.setHighWaterMark(inUse);
+        }
+        if (statsActive) {
+            synchronized (this) {
+                stats.prepareConsumers(clients);
+            }
+        } else {
+            stats.prepareConsumers(Collections.EMPTY_MAP);
+        }
+        return stats;
+    }
+
+    public static class PoolStatsImpl extends StatsImpl implements ThreadPoolStats {
+        private BoundedRangeImpl threadsInUse = new BoundedRangeImpl("Threads In Use", "", "The number of threads in use by this thread pool");
+        private Map consumers = new HashMap();
+
+        public PoolStatsImpl() {
+            addStat(threadsInUse.getName(), threadsInUse);
+        }
+
+        public BoundedRangeStatistic getThreadsInUse() {
+            return threadsInUse;
+        }
+
+        public CountStatistic getCountForConsumer(String consumer) {
+            return (CountStatistic) consumers.get(consumer);
+        }
+
+        public String[] getThreadConsumers() {
+            return (String[]) consumers.keySet().toArray(new String[consumers.size()]);
+        }
+
+        public void prepareConsumers(Map clients) {
+            Map result = new HashMap();
+            for (Iterator it = clients.keySet().iterator(); it.hasNext();) {
+                String client = (String) it.next();
+                Integer count = (Integer) clients.get(client);
+                CountStatisticImpl stat = (CountStatisticImpl) consumers.get(client);
+                if (stat == null) {
+                    stat = new CountStatisticImpl("Threads for " + client, "", "The number of threads used by the client known as '" + client + "'", count.intValue());
+                    addStat(stat.getName(), stat);
+                } else {
+                    it.remove();
+                    stat.setCount(count.intValue());
+                }
+                result.put(client, stat);
+            }
+            for (Iterator it = consumers.keySet().iterator(); it.hasNext();) {
+                String client = (String) it.next();
+                removeStat(((CountStatisticImpl) consumers.get(client)).getName());
+            }
+            consumers = result;
+        }
+    }
+
+
+    public int getPoolSize() {
+        return executor.getMaximumPoolSize();
+    }
+
     public void execute(Runnable command) throws InterruptedException {
+        execute("Unknown", command);
+    }
+
+    public void execute(final String consumerName, final Runnable runnable) throws InterruptedException {
+        Runnable command;
+        if (statsActive) {
+            command = new Runnable() {
+                public void run() {
+                    startWork(consumerName);
+                    try {
+                        runnable.run();
+                    } finally {
+                        finishWork(consumerName);
+                    }
+                }
+            };
+        } else {
+            command = runnable;
+        }
+
         PooledExecutor p;
-        synchronized(this) {
+        synchronized (this) {
             p = executor;
         }
         if (p == null) {
@@ -70,12 +190,43 @@
         p.execute(task);
     }
 
+    private synchronized void startWork(String consumerName) {
+        Integer test = (Integer) clients.get(consumerName);
+        if (test == null) {
+            clients.put(consumerName, new Integer(1));
+        } else {
+            clients.put(consumerName, new Integer(test.intValue() + 1));
+        }
+    }
+
+    private synchronized void finishWork(String consumerName) {
+        Integer test = (Integer) clients.get(consumerName);
+        if (test.intValue() == 1) {
+            clients.remove(consumerName);
+        } else {
+            clients.put(consumerName, new Integer(test.intValue() - 1));
+        }
+    }
+
+    public void setWaitWhenBlocked(boolean wait) {
+        waitWhenBlocked = wait;
+        if(wait) {
+            executor.waitWhenBlocked();
+        } else {
+            executor.abortWhenBlocked();
+        }
+    }
+
+    public boolean isWaitWhenBlocked() {
+        return waitWhenBlocked;
+    }
+
     public void doStart() throws Exception {
     }
 
     public void doStop() throws Exception {
         PooledExecutor p;
-        synchronized(this) {
+        synchronized (this) {
             p = executor;
             executor = null;
             classLoader = null;
@@ -151,13 +302,14 @@
         infoFactory.addAttribute("poolSize", int.class, true);
         infoFactory.addAttribute("poolName", String.class, true);
         infoFactory.addAttribute("keepAliveTime", long.class, true);
+        infoFactory.addAttribute("waitWhenBlocked", boolean.class, true);
 
         infoFactory.addAttribute("objectName", String.class, false);
         infoFactory.addAttribute("classLoader", ClassLoader.class, false);
 
         infoFactory.addInterface(GeronimoExecutor.class);
 
-        infoFactory.setConstructor(new String[] {"poolSize", "poolName", "keepAliveTime", "classLoader", "objectName"});
+        infoFactory.setConstructor(new String[]{"poolSize", "poolName", "keepAliveTime", "classLoader", "objectName"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java (original)
+++ geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java Sun Apr  9 15:58:39 2006
@@ -17,32 +17,31 @@
 
 package org.apache.geronimo.j2ee.management.impl;
 
+import java.lang.reflect.Array;
 import java.util.Hashtable;
-import java.util.Set;
 import java.util.Iterator;
-import java.lang.reflect.Array;
+import java.util.Set;
 import javax.management.ObjectName;
-
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.AbstractNameQuery;
-import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.kernel.jmx.JMXUtil;
-import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.management.geronimo.J2EEServer;
+import org.apache.geronimo.management.J2EEDeployedObject;
+import org.apache.geronimo.management.J2EEResource;
 import org.apache.geronimo.management.geronimo.EJBManager;
+import org.apache.geronimo.management.geronimo.J2EEServer;
 import org.apache.geronimo.management.geronimo.JMSManager;
-import org.apache.geronimo.management.geronimo.WebManager;
-import org.apache.geronimo.management.geronimo.SecurityRealm;
-import org.apache.geronimo.management.geronimo.LoginService;
 import org.apache.geronimo.management.geronimo.JVM;
-import org.apache.geronimo.management.J2EEDeployedObject;
-import org.apache.geronimo.management.J2EEResource;
-import org.apache.geronimo.pool.GeronimoExecutor;
+import org.apache.geronimo.management.geronimo.LoginService;
+import org.apache.geronimo.management.geronimo.SecurityRealm;
+import org.apache.geronimo.management.geronimo.ThreadPool;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
 
 /**
  * @version $Rev$ $Date$
@@ -148,8 +147,8 @@
         return (JMSManager[]) getObjects(JMSManager.class, false);
     }
 
-    public GeronimoExecutor[] getThreadPools() {
-        return (GeronimoExecutor[]) getObjects(GeronimoExecutor.class, true);
+    public ThreadPool[] getThreadPools() {
+        return (ThreadPool[]) getObjects(ThreadPool.class, true);
     }
 
     public Repository[] getRepositories() {

Modified: geronimo/branches/1.1/modules/management/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/project.xml?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/management/project.xml (original)
+++ geronimo/branches/1.1/modules/management/project.xml Sun Apr  9 15:58:39 2006
@@ -51,11 +51,6 @@
         </dependency>
         <dependency>
             <groupId>geronimo</groupId>
-            <artifactId>geronimo-core</artifactId>
-            <version>${geronimo_version}</version>
-        </dependency>
-        <dependency>
-            <groupId>geronimo</groupId>
             <artifactId>geronimo-system</artifactId>
             <version>${geronimo_version}</version>
         </dependency>

Modified: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java (original)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java Sun Apr  9 15:58:39 2006
@@ -18,7 +18,6 @@
 
 import org.apache.geronimo.management.J2EEDeployedObject;
 import org.apache.geronimo.management.J2EEResource;
-import org.apache.geronimo.pool.GeronimoExecutor;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 
@@ -74,7 +73,7 @@
      *
      * @return The ObjectNames of the thread pools, in String form.
      */
-    public GeronimoExecutor[] getThreadPools();
+    public ThreadPool[] getThreadPools();
 
     /**
      * Gets the Repositories associated with this J2EEServer.

Added: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/ThreadPool.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/ThreadPool.java?rev=392847&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/ThreadPool.java (added)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/ThreadPool.java Sun Apr  9 15:58:39 2006
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.geronimo.management.geronimo;
+
+/**
+ * Management interface for thread pools
+ *
+ * @version $Rev: 355877 $ $Date: 2005-12-10 21:48:27 -0500 (Sat, 10 Dec 2005) $
+ */
+public interface ThreadPool {
+    /**
+     * Gets the maximum number of threads allowed for this thread pool
+     */
+    int getPoolSize();
+
+    /**
+     * Executes work on behalf of a named client.  This helps the thread pool
+     * track who's using its threads.
+     * @param consumerName  A name identifying the caller, to be used in
+     *                      the management statistics for this pool, etc.
+     * @param runnable      The work to be done by a thread in the pool
+     */
+    void execute(String consumerName, Runnable runnable) throws InterruptedException;
+}

Added: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/stats/ThreadPoolStats.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/stats/ThreadPoolStats.java?rev=392847&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/stats/ThreadPoolStats.java (added)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/stats/ThreadPoolStats.java Sun Apr  9 15:58:39 2006
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.geronimo.management.geronimo.stats;
+
+import javax.management.j2ee.statistics.BoundedRangeStatistic;
+import javax.management.j2ee.statistics.CountStatistic;
+import javax.management.j2ee.statistics.Stats;
+
+/**
+ * Statistics expected for a Thread Pool implementation
+ *
+ * @version $Rev: 355877 $ $Date: 2005-12-10 21:48:27 -0500 (Sat, 10 Dec 2005) $
+ */
+public interface ThreadPoolStats extends Stats {
+    /**
+     * Gets the min and max pool size, as well as the most, least, and current
+     * number of threads in use.
+     */
+    public BoundedRangeStatistic getThreadsInUse();
+
+    /**
+     * Gets a list of the known consumers of threads from this pool.  This may
+     * not be all consumers, because they won't necessarily identify themselves,
+     * but it's a start when tracking down what's using threads in a pool.
+     */
+    public String[] getThreadConsumers();
+
+    /**
+     * For each consumer listed by getThreadConsumers(), this can be used to
+     * find out how many threads that consumer is consuming at the time these
+     * statistics were generated.
+     *
+     * @param consumer The consumer you're inquiring about
+     */
+    public CountStatistic getCountForConsumer(String consumer);
+}

Modified: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/stats/StatsImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/stats/StatsImpl.java?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/stats/StatsImpl.java (original)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/stats/StatsImpl.java Sun Apr  9 15:58:39 2006
@@ -17,10 +17,10 @@
 package org.apache.geronimo.management.stats;
 
 import java.io.Serializable;
-import java.util.Map;
 import java.util.HashMap;
-import javax.management.j2ee.statistics.Stats;
+import java.util.Map;
 import javax.management.j2ee.statistics.Statistic;
+import javax.management.j2ee.statistics.Stats;
 
 /**
  * Geronimo implementation of the JSR-77 Stats interface.  Dynamically tracks
@@ -38,6 +38,16 @@
 
     protected void addStat(String name, Statistic value) {
         stats.put(name, value);
+    }
+
+    /**
+     * Used when the available statistics are dynamic (e.g. depend on the
+     * current clients of the service, etc.).
+     * 
+     * @param name The statistic to remove
+     */
+    protected void removeStat(String name) {
+        stats.remove(name);
     }
 
     public Statistic getStatistic(String statisticName) {

Modified: geronimo/branches/1.1/modules/timer/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/timer/project.xml?rev=392847&r1=392846&r2=392847&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/timer/project.xml (original)
+++ geronimo/branches/1.1/modules/timer/project.xml Sun Apr  9 15:58:39 2006
@@ -41,6 +41,17 @@
     <!-- ============ -->
 
     <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+            <version>${geronimo_spec_j2ee_management_version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-management</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
 
         <dependency>
             <groupId>geronimo</groupId>



Mime
View raw message