[jboss-cvs] JBossAS SVN: r86544 - in projects/jboss-threads/trunk: jbossmc/src/main/java/org/jboss/threads/metadata and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 31 16:01:05 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-03-31 16:01:05 -0400 (Tue, 31 Mar 2009)
New Revision: 86544

Added:
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ThreadPoolExecutorMBean.java
Modified:
   projects/jboss-threads/trunk/jbossmc/pom.xml
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadsMetaData.java
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossThreadPoolExecutor.java
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/SimpleQueueExecutor.java
   projects/jboss-threads/trunk/main/src/test/java/org/jboss/threads/ThreadPoolTestCase.java
Log:
Add JMX support to jboss-threads (JBTHR-1)

Modified: projects/jboss-threads/trunk/jbossmc/pom.xml
===================================================================
--- projects/jboss-threads/trunk/jbossmc/pom.xml	2009-03-31 17:57:31 UTC (rev 86543)
+++ projects/jboss-threads/trunk/jbossmc/pom.xml	2009-03-31 20:01:05 UTC (rev 86544)
@@ -21,6 +21,11 @@
             <version>2.0.2.GA</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>org.jboss.microcontainer</groupId>
+            <artifactId>jboss-aop-mc-int</artifactId>
+            <version>2.0.4.GA</version>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

Modified: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadsMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadsMetaData.java	2009-03-31 17:57:31 UTC (rev 86543)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadsMetaData.java	2009-03-31 20:01:05 UTC (rev 86544)
@@ -37,9 +37,9 @@
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import static java.lang.Math.max;
+import java.lang.annotation.Annotation;
 import org.jboss.xb.annotations.JBossXmlSchema;
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.beans.metadata.spi.ValueMetaData;
@@ -54,6 +54,8 @@
 import org.jboss.threads.JBossThreadPoolExecutor;
 import org.jboss.threads.DirectExecutor;
 import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.aop.microcontainer.aspects.jmx.JMX;
+import org.jboss.util.threadpool.ThreadPoolMBean;
 
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlNsForm;
@@ -303,6 +305,7 @@
                 } else {
                     queue = new ArrayQueue<Runnable>(queueLength.intValue());
                 }
+                executorBuilder.addConstructorParameter(String.class.getName(), name);
                 executorBuilder.addConstructorParameter("int", Integer.valueOf(corePoolSize));
                 executorBuilder.addConstructorParameter("int", Integer.valueOf(maxPoolSize));
                 executorBuilder.addConstructorParameter("long", Long.valueOf(time));
@@ -344,6 +347,7 @@
                 } else {
                     queue = new ArrayBlockingQueue<Runnable>(queueLength.intValue());
                 }
+                executorBuilder.addConstructorParameter(String.class.getName(), name);
                 executorBuilder.addConstructorParameter("int", Integer.valueOf(corePoolSize));
                 executorBuilder.addConstructorParameter("int", Integer.valueOf(maxPoolSize));
                 executorBuilder.addConstructorParameter("long", Long.valueOf(time));
@@ -352,6 +356,23 @@
                 executorBuilder.addConstructorParameter(ThreadFactory.class.getName(), executorBuilder.createInject(threadFactory));
                 executorBuilder.addConstructorParameter(RejectedExecutionHandler.class.getName(), policyValue);
             }
+            executorBuilder.addAnnotation(new JMX() {
+                public Class<?> exposedInterface() {
+                    return ThreadPoolMBean.class;
+                }
+
+                public String name() {
+                    return "org.jboss.threads:service=ThreadPool,name=" + name;
+                }
+
+                public boolean registerDirectly() {
+                    return true;
+                }
+
+                public Class<? extends Annotation> annotationType() {
+                    return JMX.class;
+                }
+            });
             executorBuilder.setMode(ControllerMode.ON_DEMAND);
 //            final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, ExecutorService.class.getName());
 //            builder.setFactoryClass(JBossExecutors.class.getName());

Modified: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossThreadPoolExecutor.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossThreadPoolExecutor.java	2009-03-31 17:57:31 UTC (rev 86543)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossThreadPoolExecutor.java	2009-03-31 20:01:05 UTC (rev 86544)
@@ -27,26 +27,37 @@
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.RejectedExecutionHandler;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.lang.reflect.Method;
 
 /**
  *
  */
-public final class JBossThreadPoolExecutor extends ThreadPoolExecutor {
+public final class JBossThreadPoolExecutor extends ThreadPoolExecutor implements ThreadPoolExecutorMBean {
 
-    public JBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
+    private final String name;
+    private final AtomicInteger rejectCount = new AtomicInteger();
+
+    public JBossThreadPoolExecutor(final String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
         super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
+        this.name = name;
     }
 
-    public JBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
+    public JBossThreadPoolExecutor(final String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
         super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
+        this.name = name;
     }
 
-    public JBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
-        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
+    public JBossThreadPoolExecutor(final String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
+        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
+        setRejectedExecutionHandler(handler);
+        this.name = name;
     }
 
-    public JBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
-        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
+    public JBossThreadPoolExecutor(final String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
+        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
+        setRejectedExecutionHandler(handler);
+        this.name = name;
     }
 
     public void stop() {
@@ -71,4 +82,95 @@
             Thread.currentThread().interrupt();
         }
     }
+
+    private static final Method GET_ALLOW_CORE_THREAD_TIMEOUT;
+    private static final Method SET_ALLOW_CORE_THREAD_TIMEOUT;
+
+    static {
+        Method method = null;
+        try {
+            method = ThreadPoolExecutor.class.getMethod("allowsCoreThreadTimeOut");
+        } catch (NoSuchMethodException e) {
+        }
+        GET_ALLOW_CORE_THREAD_TIMEOUT = method;
+        try {
+            method = ThreadPoolExecutor.class.getMethod("allowCoreThreadTimeOut", boolean.class);
+        } catch (NoSuchMethodException e) {
+        }
+        SET_ALLOW_CORE_THREAD_TIMEOUT = method;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public boolean isAllowCoreThreadTimeout() {
+        final Method method = GET_ALLOW_CORE_THREAD_TIMEOUT;
+        try {
+            return method != null ? ((Boolean) method.invoke(this)).booleanValue() : false;
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
+    public void setAllowCoreThreadTimeout(final boolean allow) {
+        final Method method = SET_ALLOW_CORE_THREAD_TIMEOUT;
+        try {
+            if (method != null) {
+                method.invoke(this, Boolean.valueOf(allow));
+                return;
+            }
+        } catch (Exception e) {
+        }
+        throw new UnsupportedOperationException();
+    }
+
+    public int getMaxPoolSize() {
+        return getMaximumPoolSize();
+    }
+
+    public void setMaxPoolSize(final int newSize) {
+        setMaximumPoolSize(newSize);
+    }
+
+    public long getKeepAliveTime() {
+        return getKeepAliveTime(TimeUnit.MILLISECONDS);
+    }
+
+    public void setKeepAliveTime(final long milliseconds) {
+        setKeepAliveTime(milliseconds, TimeUnit.MILLISECONDS);
+    }
+
+    public int getCurrentPoolSize() {
+        return getPoolSize();
+    }
+
+    public int getRejectedCount() {
+        return rejectCount.get();
+    }
+
+    public RejectedExecutionHandler getRejectedExecutionHandler() {
+        return ((CountingRejectHandler)super.getRejectedExecutionHandler()).getDelegate();
+    }
+
+    public void setRejectedExecutionHandler(final RejectedExecutionHandler handler) {
+        super.setRejectedExecutionHandler(new CountingRejectHandler(handler));
+    }
+
+    private final class CountingRejectHandler implements RejectedExecutionHandler {
+        private final RejectedExecutionHandler delegate;
+
+        public CountingRejectHandler(final RejectedExecutionHandler delegate) {
+            this.delegate = delegate;
+        }
+
+        public RejectedExecutionHandler getDelegate() {
+            return delegate;
+        }
+
+        public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) {
+            rejectCount.incrementAndGet();
+            delegate.rejectedExecution(r, executor);
+        }
+    }
 }

Modified: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/SimpleQueueExecutor.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/SimpleQueueExecutor.java	2009-03-31 17:57:31 UTC (rev 86543)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/SimpleQueueExecutor.java	2009-03-31 20:01:05 UTC (rev 86544)
@@ -40,7 +40,8 @@
 /**
  * An executor which uses a regular queue to hold tasks.  The executor may be tuned at runtime in many ways.
  */
-public final class SimpleQueueExecutor extends AbstractExecutorService implements ExecutorService {
+public final class SimpleQueueExecutor extends AbstractExecutorService implements ExecutorService, ThreadPoolExecutorMBean {
+    private final String name;
     private final Lock lock = new ReentrantLock();
     // signal when a task is written to the queue
     private final Condition enqueueCondition = lock.newCondition();
@@ -51,8 +52,10 @@
     private final ThreadFactory threadFactory;
 
     // all protected by poolLock...
-    private int coreThreadLimit;
-    private int maxThreadLimit;
+    private int corePoolSize;
+    private int maxPoolSize;
+    private int largestPoolSize;
+    private int rejectCount;
     private boolean allowCoreThreadTimeout;
     private long keepAliveTime;
     private TimeUnit keepAliveTimeUnit;
@@ -67,7 +70,8 @@
 
     private Queue<Runnable> queue;
 
-    public SimpleQueueExecutor(final int coreThreadLimit, final int maxThreadLimit, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final Queue<Runnable> queue, final ThreadFactory threadFactory, final RejectionPolicy rejectionPolicy, final Executor handoffExecutor) {
+    public SimpleQueueExecutor(final String name, final int corePoolSize, final int maxPoolSize, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final Queue<Runnable> queue, final ThreadFactory threadFactory, final RejectionPolicy rejectionPolicy, final Executor handoffExecutor) {
+        this.name = name;
         if (threadFactory == null) {
             throw new NullPointerException("threadFactory is null");
         }
@@ -90,8 +94,8 @@
             // configurable...
             this.keepAliveTime = keepAliveTime;
             this.keepAliveTimeUnit = keepAliveTimeUnit;
-            this.coreThreadLimit = coreThreadLimit;
-            this.maxThreadLimit = maxThreadLimit;
+            this.corePoolSize = corePoolSize;
+            this.maxPoolSize = maxPoolSize;
             this.queue = queue;
             this.rejectionPolicy = rejectionPolicy;
             this.handoffExecutor = handoffExecutor;
@@ -111,7 +115,7 @@
                     }
                     // Try core thread first, then queue, then extra thread
                     final int count = threadCount;
-                    if (count < coreThreadLimit) {
+                    if (count < corePoolSize) {
                         startNewThread(task);
                         threadCount = count + 1;
                         return;
@@ -123,11 +127,12 @@
                         return;
                     }
                     // extra threads?
-                    if (count < maxThreadLimit) {
+                    if (count < maxPoolSize) {
                         startNewThread(task);
                         threadCount = count + 1;
                         return;
                     }
+                    rejectCount++;
                     // how to reject the task...
                     switch (rejectionPolicy) {
                         case ABORT:
@@ -259,30 +264,30 @@
         }
     }
 
-    public int getCoreThreadLimit() {
+    public int getCorePoolSize() {
         final Lock lock = this.lock;
         lock.lock();
         try {
-            return coreThreadLimit;
+            return corePoolSize;
         } finally {
             lock.unlock();
         }
     }
 
-    public void setCoreThreadLimit(final int coreThreadLimit) {
+    public void setCorePoolSize(final int corePoolSize) {
         final Lock lock = this.lock;
         lock.lock();
         try {
-            final int oldLimit = this.coreThreadLimit;
-            if (maxThreadLimit < coreThreadLimit) {
+            final int oldLimit = this.corePoolSize;
+            if (maxPoolSize < corePoolSize) {
                 // don't let the max thread limit be less than the core thread limit.
                 // the called method will signal as needed
-                setMaxThreadLimit(coreThreadLimit);
-            } else if (oldLimit < coreThreadLimit) {
+                setMaxPoolSize(corePoolSize);
+            } else if (oldLimit < corePoolSize) {
                 // we're growing the number of core threads
                 // therefore signal anyone waiting to add tasks; there might be more threads to add
                 removeCondition.signalAll();
-            } else if (oldLimit > coreThreadLimit) {
+            } else if (oldLimit > corePoolSize) {
                 // we're shrinking the number of core threads
                 // therefore signal anyone waiting to remove tasks so the pool can shrink properly
                 enqueueCondition.signalAll();
@@ -290,36 +295,36 @@
                 // we aren't changing anything...
                 return;
             }
-            this.coreThreadLimit = coreThreadLimit;
+            this.corePoolSize = corePoolSize;
         } finally {
             lock.unlock();
         }
     }
 
-    public int getMaxThreadLimit() {
+    public int getMaxPoolSize() {
         final Lock lock = this.lock;
         lock.lock();
         try {
-            return maxThreadLimit;
+            return maxPoolSize;
         } finally {
             lock.unlock();
         }
     }
 
-    public void setMaxThreadLimit(final int maxThreadLimit) {
+    public void setMaxPoolSize(final int maxPoolSize) {
         final Lock lock = this.lock;
         lock.lock();
         try {
-            final int oldLimit = this.maxThreadLimit;
-            if (maxThreadLimit < coreThreadLimit) {
+            final int oldLimit = this.maxPoolSize;
+            if (maxPoolSize < corePoolSize) {
                 // don't let the max thread limit be less than the core thread limit.
                 // the called method will signal as needed
-                setCoreThreadLimit(maxThreadLimit);
-            } else if (oldLimit < maxThreadLimit) {
+                setCorePoolSize(maxPoolSize);
+            } else if (oldLimit < maxPoolSize) {
                 // we're growing the number of extra threads
                 // therefore signal anyone waiting to add tasks; there might be more threads to add
                 removeCondition.signalAll();
-            } else if (oldLimit > maxThreadLimit) {
+            } else if (oldLimit > maxPoolSize) {
                 // we're shrinking the number of extra threads
                 // therefore signal anyone waiting to remove tasks so the pool can shrink properly
                 enqueueCondition.signalAll();
@@ -327,7 +332,7 @@
                 // we aren't changing anything...
                 return;
             }
-            this.maxThreadLimit = maxThreadLimit;
+            this.maxPoolSize = maxPoolSize;
         } finally {
             lock.unlock();
         }
@@ -343,16 +348,6 @@
         }
     }
 
-    public TimeUnit getKeepAliveTimeUnit() {
-        final Lock lock = this.lock;
-        lock.lock();
-        try {
-            return keepAliveTimeUnit;
-        } finally {
-            lock.unlock();
-        }
-    }
-
     public void setKeepAliveTime(final long keepAliveTime, final TimeUnit keepAliveTimeUnit) {
         if (keepAliveTimeUnit == null) {
             throw new NullPointerException("keepAliveTimeUnit is null");
@@ -363,13 +358,16 @@
         final Lock lock = this.lock;
         lock.lock();
         try {
-            this.keepAliveTime = keepAliveTime;
-            this.keepAliveTimeUnit = keepAliveTimeUnit;
+            this.keepAliveTime = keepAliveTimeUnit.convert(keepAliveTime, TimeUnit.MILLISECONDS);
         } finally {
             lock.unlock();
         }
     }
 
+    public void setKeepAliveTime(final long milliseconds) {
+        setKeepAliveTime(milliseconds, TimeUnit.MILLISECONDS);
+    }
+
     public RejectionPolicy getRejectionPolicy() {
         final Lock lock = this.lock;
         lock.lock();
@@ -429,6 +427,10 @@
     private void startNewThread(final Runnable task) {
         final Thread thread = threadFactory.newThread(new Worker(task));
         workers.add(thread);
+        final int size = workers.size();
+        if (size > largestPoolSize) {
+            largestPoolSize = size;
+        }
         thread.start();
     }
 
@@ -462,9 +464,9 @@
                 for (;;) {
                     // these parameters may change on each iteration
                     final int threadCount = this.threadCount;
-                    final int coreThreadLimit = this.coreThreadLimit;
+                    final int coreThreadLimit = corePoolSize;
                     final boolean allowCoreThreadTimeout = this.allowCoreThreadTimeout;
-                    if (stop || threadCount > maxThreadLimit) {
+                    if (stop || threadCount > maxPoolSize) {
                         // too many threads.  Handle a task if there is one, otherwise exit
                         return pollTask();
                     } else if (!allowCoreThreadTimeout && threadCount < coreThreadLimit) {
@@ -503,6 +505,40 @@
         }
     }
 
+    public String getName() {
+        return name;
+    }
+
+    public int getCurrentPoolSize() {
+        final Lock lock = this.lock;
+        lock.lock();
+        try {
+            return workers.size();
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    public int getLargestPoolSize() {
+        final Lock lock = this.lock;
+        lock.lock();
+        try {
+            return largestPoolSize;
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    public int getRejectedCount() {
+        final Lock lock = this.lock;
+        lock.lock();
+        try {
+            return rejectCount;
+        } finally {
+            lock.unlock();
+        }
+    }
+
     private class Worker implements Runnable {
 
         private Runnable first;

Added: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ThreadPoolExecutorMBean.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ThreadPoolExecutorMBean.java	                        (rev 0)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ThreadPoolExecutorMBean.java	2009-03-31 20:01:05 UTC (rev 86544)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.threads;
+
+/**
+ *
+ */
+public interface ThreadPoolExecutorMBean {
+    String getName();
+
+    boolean isAllowCoreThreadTimeout();
+
+    void setAllowCoreThreadTimeout(boolean allow);
+
+    int getCorePoolSize();
+
+    void setCorePoolSize(int newSize);
+
+    int getMaxPoolSize();
+
+    void setMaxPoolSize(int newSize);
+
+    long getKeepAliveTime();
+
+    void setKeepAliveTime(long milliseconds);
+
+    int getCurrentPoolSize();
+
+    int getLargestPoolSize();
+
+    int getRejectedCount();
+}

Modified: projects/jboss-threads/trunk/main/src/test/java/org/jboss/threads/ThreadPoolTestCase.java
===================================================================
--- projects/jboss-threads/trunk/main/src/test/java/org/jboss/threads/ThreadPoolTestCase.java	2009-03-31 17:57:31 UTC (rev 86543)
+++ projects/jboss-threads/trunk/main/src/test/java/org/jboss/threads/ThreadPoolTestCase.java	2009-03-31 20:01:05 UTC (rev 86544)
@@ -62,7 +62,7 @@
         final int cnt = 100;
         final CountDownLatch taskUnfreezer = new CountDownLatch(1);
         final CountDownLatch taskFinishLine = new CountDownLatch(cnt);
-        final ExecutorService simpleQueueExecutor = new SimpleQueueExecutor(5, 5, 500L, TimeUnit.MILLISECONDS, new LinkedList<Runnable>(), threadFactory, RejectionPolicy.BLOCK, null);
+        final ExecutorService simpleQueueExecutor = new SimpleQueueExecutor("test-pool", 5, 5, 500L, TimeUnit.MILLISECONDS, new LinkedList<Runnable>(), threadFactory, RejectionPolicy.BLOCK, null);
         for (int i = 0; i < cnt; i ++) {
             simpleQueueExecutor.execute(new SimpleTask(taskUnfreezer, taskFinishLine));
         }
@@ -87,7 +87,7 @@
         final AtomicBoolean ran = new AtomicBoolean();
 
         final CountDownLatch startLatch = new CountDownLatch(1);
-        final ExecutorService simpleQueueExecutor = new SimpleQueueExecutor(5, 5, 500L, TimeUnit.MILLISECONDS, new LinkedList<Runnable>(), threadFactory, RejectionPolicy.BLOCK, null);
+        final ExecutorService simpleQueueExecutor = new SimpleQueueExecutor("test-pool", 5, 5, 500L, TimeUnit.MILLISECONDS, new LinkedList<Runnable>(), threadFactory, RejectionPolicy.BLOCK, null);
         simpleQueueExecutor.execute(new Runnable() {
             public void run() {
                 try {
@@ -121,7 +121,7 @@
         final int cnt = queueSize + coreThreads + extraThreads;
         final CountDownLatch taskUnfreezer = new CountDownLatch(1);
         final CountDownLatch taskFinishLine = new CountDownLatch(cnt);
-        final ExecutorService simpleQueueExecutor = new SimpleQueueExecutor(coreThreads, coreThreads + extraThreads, 500L, TimeUnit.MILLISECONDS, new ArrayQueue<Runnable>(queueSize), threadFactory, RejectionPolicy.BLOCK, null);
+        final ExecutorService simpleQueueExecutor = new SimpleQueueExecutor("test-pool", coreThreads, coreThreads + extraThreads, 500L, TimeUnit.MILLISECONDS, new ArrayQueue<Runnable>(queueSize), threadFactory, RejectionPolicy.BLOCK, null);
         for (int i = 0; i < cnt; i ++) {
             simpleQueueExecutor.execute(new SimpleTask(taskUnfreezer, taskFinishLine));
         }




More information about the jboss-cvs-commits mailing list