[jboss-cvs] JBossAS SVN: r99355 - in projects/jboss-threads/trunk: jbossmc and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 13 14:57:38 EST 2010


Author: david.lloyd at jboss.com
Date: 2010-01-13 14:57:37 -0500 (Wed, 13 Jan 2010)
New Revision: 99355

Added:
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/AbstractTaskFilter.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/BoundedOrderedExecutorMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/BoundedQueueThreadPoolExecutorMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/CleanerFilter.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ClearContextClassLoaderFilter.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ClearTLSFilter.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/InitializerFilter.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/LogExceptionsFilter.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/QueuelessThreadPoolExecutorMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/RefMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ScaledCountMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/TaskFilterMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadFactoryExecutorMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadNameFilter.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadNameNotationFilter.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadsHelper.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/UnboundedOrderedExecutorMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/UnboundedQueueThreadPoolExecutorMetaData.java
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossScheduledThreadPoolExecutor.java
Removed:
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ExceptionHandlerRefMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/PoolSizeMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadPoolExecutorMetaData.java
Modified:
   projects/jboss-threads/trunk/jbossmc/
   projects/jboss-threads/trunk/jbossmc/pom.xml
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/DirectExecutorMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ScheduledThreadPoolExecutorMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadFactoryMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadGroupMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadsMetaData.java
   projects/jboss-threads/trunk/jbossmc/src/main/resources/schema/jboss-threads_2_0.xsd
   projects/jboss-threads/trunk/main/pom.xml
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ExceptionLoggingExecutor.java
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossExecutors.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/OrderedExecutor.java
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/QueueExecutor.java
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/QueuelessExecutor.java
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ThreadFactoryExecutor.java
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/management/ThreadExecutorMBean.java
   projects/jboss-threads/trunk/main/src/test/java/org/jboss/threads/ThreadPoolTestCase.java
   projects/jboss-threads/trunk/pom.xml
Log:
Threads 2.0 metadata fixes and changes to threads support classes


Property changes on: projects/jboss-threads/trunk/jbossmc
___________________________________________________________________
Name: svn:ignore
   + target


Modified: projects/jboss-threads/trunk/jbossmc/pom.xml
===================================================================
--- projects/jboss-threads/trunk/jbossmc/pom.xml	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/jbossmc/pom.xml	2010-01-13 19:57:37 UTC (rev 99355)
@@ -7,24 +7,24 @@
     <groupId>org.jboss.threads</groupId>
     <artifactId>jboss-threads-metadata</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.0.CR1-SNAPSHOT</version>
+    <version>2.0.0.CR1</version>
     <dependencies>
         <dependency>
             <groupId>org.jboss.threads</groupId>
             <artifactId>jboss-threads</artifactId>
-            <version>1.0.0.GA</version>
+            <version>2.0.0.CR1</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.jboss.microcontainer</groupId>
             <artifactId>jboss-kernel</artifactId>
-            <version>2.0.2.GA</version>
+            <version>2.0.9.GA</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.jboss.microcontainer</groupId>
             <artifactId>jboss-aop-mc-int</artifactId>
-            <version>2.0.4.GA</version>
+            <version>2.0.9.GA</version>
         </dependency>
     </dependencies>
     <build>

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/AbstractTaskFilter.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/AbstractTaskFilter.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/AbstractTaskFilter.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import java.util.List;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+
+public abstract class AbstractTaskFilter {
+    protected abstract void addTo(final BeanMetaDataBuilder builder, final List<ValueMetaData> objectList);
+}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/BoundedOrderedExecutorMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/BoundedOrderedExecutorMetaData.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/BoundedOrderedExecutorMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+ at XmlType(name = "bounded-ordered-executor")
+public final class BoundedOrderedExecutorMetaData {
+    private String name;
+    private boolean blocking;
+    private RefMetaData parentExecutor;
+    private ScaledCountMetaData queueLength;
+    private RefMetaData handoffExecutor;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public boolean isBlocking() {
+        return blocking;
+    }
+
+    @XmlAttribute
+    public void setBlocking(final boolean blocking) {
+        this.blocking = blocking;
+    }
+
+    public RefMetaData getParentExecutor() {
+        return parentExecutor;
+    }
+
+    @XmlElement(name = "parent-executor", required = true)
+    public void setParentExecutor(final RefMetaData parentExecutor) {
+        this.parentExecutor = parentExecutor;
+    }
+
+    public ScaledCountMetaData getQueueLength() {
+        return queueLength;
+    }
+
+    @XmlElement(name = "queue-length", required = true)
+    public void setQueueLength(final ScaledCountMetaData queueLength) {
+        this.queueLength = queueLength;
+    }
+
+    public RefMetaData getHandoffExecutor() {
+        return handoffExecutor;
+    }
+
+    @XmlElement(name = "handoff-executor")
+    public void setHandoffExecutor(final RefMetaData handoffExecutor) {
+        this.handoffExecutor = handoffExecutor;
+    }
+}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/BoundedQueueThreadPoolExecutorMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/BoundedQueueThreadPoolExecutorMetaData.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/BoundedQueueThreadPoolExecutorMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+ at XmlType(name = "bounded-queue-thread-pool-executor")
+public final class BoundedQueueThreadPoolExecutorMetaData {
+    private String name;
+    private boolean allowCoreTimeout;
+    private boolean blocking;
+    private ScaledCountMetaData coreThreads;
+    private ScaledCountMetaData queueLength;
+    private ScaledCountMetaData maxThreads;
+    private TimeMetaData keepaliveTime;
+    private TaskFilterMetaData taskFilter;
+    private RefMetaData threadFactory;
+    private RefMetaData handoffExecutor;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public boolean isAllowCoreTimeout() {
+        return allowCoreTimeout;
+    }
+
+    @XmlAttribute
+    public void setAllowCoreTimeout(final boolean allowCoreTimeout) {
+        this.allowCoreTimeout = allowCoreTimeout;
+    }
+
+    public boolean isBlocking() {
+        return blocking;
+    }
+
+    @XmlAttribute
+    public void setBlocking(final boolean blocking) {
+        this.blocking = blocking;
+    }
+
+    public ScaledCountMetaData getCoreThreads() {
+        return coreThreads;
+    }
+
+    @XmlElement(name = "core-threads", required = true)
+    public void setCoreThreads(final ScaledCountMetaData coreThreads) {
+        this.coreThreads = coreThreads;
+    }
+
+    public ScaledCountMetaData getQueueLength() {
+        return queueLength;
+    }
+
+    @XmlElement(name = "queue-length", required = true)
+    public void setQueueLength(final ScaledCountMetaData queueLength) {
+        this.queueLength = queueLength;
+    }
+
+    public ScaledCountMetaData getMaxThreads() {
+        return maxThreads;
+    }
+
+    @XmlElement(name = "max-threads")
+    public void setMaxThreads(final ScaledCountMetaData maxThreads) {
+        this.maxThreads = maxThreads;
+    }
+
+    public TimeMetaData getKeepaliveTime() {
+        return keepaliveTime;
+    }
+
+    @XmlElement(name = "keepalive-time")
+    public void setKeepaliveTime(final TimeMetaData keepaliveTime) {
+        this.keepaliveTime = keepaliveTime;
+    }
+
+    public TaskFilterMetaData getTaskFilter() {
+        return taskFilter;
+    }
+
+    @XmlElement(name = "task-filter")
+    public void setTaskFilter(final TaskFilterMetaData taskFilter) {
+        this.taskFilter = taskFilter;
+    }
+
+    public RefMetaData getThreadFactory() {
+        return threadFactory;
+    }
+
+    @XmlElement(name = "thread-factory")
+    public void setThreadFactory(final RefMetaData threadFactory) {
+        this.threadFactory = threadFactory;
+    }
+
+    public RefMetaData getHandoffExecutor() {
+        return handoffExecutor;
+    }
+
+    @XmlElement(name = "handoff-executor")
+    public void setHandoffExecutor(final RefMetaData handoffExecutor) {
+        this.handoffExecutor = handoffExecutor;
+    }
+}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/CleanerFilter.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/CleanerFilter.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/CleanerFilter.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import java.util.List;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+public final class CleanerFilter extends AbstractTaskFilter {
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    protected void addTo(final BeanMetaDataBuilder builder, final List<ValueMetaData> objectList) {
+        objectList.add(builder.createValue(ThreadsHelper.FilterTypes.CLEANER));
+        objectList.add(builder.createValue(name));
+    }
+}
\ No newline at end of file

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ClearContextClassLoaderFilter.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ClearContextClassLoaderFilter.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ClearContextClassLoaderFilter.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import java.util.List;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+
+public final class ClearContextClassLoaderFilter extends AbstractTaskFilter {
+
+    protected void addTo(final BeanMetaDataBuilder builder, final List<ValueMetaData> objectList) {
+        objectList.add(builder.createValue(ThreadsHelper.FilterTypes.CLEAR_CONTEXT_CLASSLOADER));
+    }
+}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ClearTLSFilter.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ClearTLSFilter.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ClearTLSFilter.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import java.util.List;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+
+public final class ClearTLSFilter extends AbstractTaskFilter {
+
+    protected void addTo(final BeanMetaDataBuilder builder, final List<ValueMetaData> objectList) {
+        objectList.add(builder.createValue(ThreadsHelper.FilterTypes.CLEAR_TLS));
+    }
+}

Modified: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/DirectExecutorMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/DirectExecutorMetaData.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/DirectExecutorMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -23,6 +23,7 @@
 package org.jboss.threads.metadata;
 
 import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 
 /**
@@ -31,6 +32,7 @@
 @XmlType(name = "direct-executor", propOrder = {})
 public final class DirectExecutorMetaData {
     private String name;
+    private TaskFilterMetaData taskFilter;
 
     public String getName() {
         return name;
@@ -40,4 +42,13 @@
     public void setName(final String name) {
         this.name = name;
     }
+
+    public TaskFilterMetaData getTaskFilter() {
+        return taskFilter;
+    }
+
+    @XmlElement(name = "task-filter")
+    public void setTaskFilter(final TaskFilterMetaData taskFilter) {
+        this.taskFilter = taskFilter;
+    }
 }

Deleted: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ExceptionHandlerRefMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ExceptionHandlerRefMetaData.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ExceptionHandlerRefMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.metadata;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- *
- */
- at XmlType(name = "exception-handler", propOrder = {})
-public final class ExceptionHandlerRefMetaData {
-    private String name;
-
-    public String getName() {
-        return name;
-    }
-
-    @XmlAttribute(required = true)
-    public void setName(final String name) {
-        this.name = name;
-    }
-}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/InitializerFilter.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/InitializerFilter.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/InitializerFilter.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import java.util.List;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+public final class InitializerFilter extends AbstractTaskFilter {
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    protected void addTo(final BeanMetaDataBuilder builder, final List<ValueMetaData> objectList) {
+        objectList.add(builder.createValue(ThreadsHelper.FilterTypes.INITIALIZER));
+        objectList.add(builder.createInject(name));
+    }
+}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/LogExceptionsFilter.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/LogExceptionsFilter.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/LogExceptionsFilter.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import java.util.List;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+public final class LogExceptionsFilter extends AbstractTaskFilter {
+    private String category;
+    private String level;
+
+    public String getCategory() {
+        return category;
+    }
+
+    @XmlAttribute(required = true)
+    public void setCategory(final String category) {
+        this.category = category;
+    }
+
+    public String getLevel() {
+        return level;
+    }
+
+    @XmlAttribute
+    public void setLevel(final String level) {
+        this.level = level;
+    }
+
+    protected void addTo(final BeanMetaDataBuilder builder, final List<ValueMetaData> objectList) {
+        objectList.add(builder.createValue(ThreadsHelper.FilterTypes.LOG_EXCEPTIONS));
+        objectList.add(builder.createValue(category));
+        objectList.add(builder.createValue(level));
+    }
+}

Deleted: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/PoolSizeMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/PoolSizeMetaData.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/PoolSizeMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.metadata;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- *
- */
- at XmlType(name = "pool-size", propOrder = {})
-public final class PoolSizeMetaData {
-    private float count;
-    private float perCpu;
-
-    public float getCount() {
-        return count;
-    }
-
-    @XmlAttribute
-    public void setCount(final float count) {
-        this.count = count;
-    }
-
-    public float getPerCpu() {
-        return perCpu;
-    }
-
-    @XmlAttribute(name = "per-cpu")
-    public void setPerCpu(final float perCpu) {
-        this.perCpu = perCpu;
-    }
-}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/QueuelessThreadPoolExecutorMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/QueuelessThreadPoolExecutorMetaData.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/QueuelessThreadPoolExecutorMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+
+public final class QueuelessThreadPoolExecutorMetaData {
+    private String name;
+    private boolean blocking;
+    private ScaledCountMetaData coreThreads;
+    private TimeMetaData keepaliveTime;
+    private TaskFilterMetaData taskFilter;
+    private RefMetaData threadFactory;
+    private RefMetaData handoffExecutor;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public boolean isBlocking() {
+        return blocking;
+    }
+
+    @XmlAttribute
+    public void setBlocking(final boolean blocking) {
+        this.blocking = blocking;
+    }
+
+    public ScaledCountMetaData getCoreThreads() {
+        return coreThreads;
+    }
+
+    @XmlElement(name = "core-threads", required = true)
+    public void setCoreThreads(final ScaledCountMetaData coreThreads) {
+        this.coreThreads = coreThreads;
+    }
+
+    public TimeMetaData getKeepaliveTime() {
+        return keepaliveTime;
+    }
+
+    @XmlElement(name = "keepalive-time")
+    public void setKeepaliveTime(final TimeMetaData keepaliveTime) {
+        this.keepaliveTime = keepaliveTime;
+    }
+
+    public TaskFilterMetaData getTaskFilter() {
+        return taskFilter;
+    }
+
+    @XmlElement(name = "task-filter")
+    public void setTaskFilter(final TaskFilterMetaData taskFilter) {
+        this.taskFilter = taskFilter;
+    }
+
+    public RefMetaData getThreadFactory() {
+        return threadFactory;
+    }
+
+    @XmlElement(name = "thread-factory")
+    public void setThreadFactory(final RefMetaData threadFactory) {
+        this.threadFactory = threadFactory;
+    }
+
+    public RefMetaData getHandoffExecutor() {
+        return handoffExecutor;
+    }
+
+    @XmlElement(name = "handoff-executor")
+    public void setHandoffExecutor(final RefMetaData handoffExecutor) {
+        this.handoffExecutor = handoffExecutor;
+    }
+}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/RefMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/RefMetaData.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/RefMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+ at XmlType(name = "ref", propOrder = {})
+public final class RefMetaData {
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+}

Copied: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ScaledCountMetaData.java (from rev 99252, projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/PoolSizeMetaData.java)
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ScaledCountMetaData.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ScaledCountMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ */
+ at XmlType(name = "scaled-count", propOrder = {})
+public final class ScaledCountMetaData {
+    private float count;
+    private float perCpu;
+
+    public float getCount() {
+        return count;
+    }
+
+    @XmlAttribute
+    public void setCount(final float count) {
+        this.count = count;
+    }
+
+    public float getPerCpu() {
+        return perCpu;
+    }
+
+    @XmlAttribute(name = "per-cpu")
+    public void setPerCpu(final float perCpu) {
+        this.perCpu = perCpu;
+    }
+}

Modified: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ScheduledThreadPoolExecutorMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ScheduledThreadPoolExecutorMetaData.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ScheduledThreadPoolExecutorMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -28,9 +28,12 @@
 
 @XmlType(name = "scheduled-thread-pool-executor", propOrder = {})
 public final class ScheduledThreadPoolExecutorMetaData {
+
     private String name;
-    private String threadFactory;
-    private PoolSizeMetaData poolSize;
+    private ScaledCountMetaData coreThreads;
+    private TimeMetaData keepaliveTime;
+    private TaskFilterMetaData taskFilter;
+    private RefMetaData threadFactory;
 
     public String getName() {
         return name;
@@ -41,21 +44,39 @@
         this.name = name;
     }
 
-    public String getThreadFactory() {
-        return threadFactory;
+    public ScaledCountMetaData getCoreThreads() {
+        return coreThreads;
     }
 
-    @XmlAttribute(name = "thread-factory", required = true)
-    public void setThreadFactory(final String threadFactory) {
-        this.threadFactory = threadFactory;
+    @XmlElement(name = "core-threads", required = true)
+    public void setCoreThreads(final ScaledCountMetaData coreThreads) {
+        this.coreThreads = coreThreads;
     }
 
-    public PoolSizeMetaData getPoolSize() {
-        return poolSize;
+    public TimeMetaData getKeepaliveTime() {
+        return keepaliveTime;
     }
 
-    @XmlElement(name = "pool-size")
-    public void setPoolSize(final PoolSizeMetaData poolSize) {
-        this.poolSize = poolSize;
+    @XmlElement(name = "keepalive-time")
+    public void setKeepaliveTime(final TimeMetaData keepaliveTime) {
+        this.keepaliveTime = keepaliveTime;
     }
+
+    public TaskFilterMetaData getTaskFilter() {
+        return taskFilter;
+    }
+
+    @XmlElement(name = "task-filter")
+    public void setTaskFilter(final TaskFilterMetaData taskFilter) {
+        this.taskFilter = taskFilter;
+    }
+
+    public RefMetaData getThreadFactory() {
+        return threadFactory;
+    }
+
+    @XmlElement(name = "thread-factory")
+    public void setThreadFactory(final RefMetaData threadFactory) {
+        this.threadFactory = threadFactory;
+    }
 }

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/TaskFilterMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/TaskFilterMetaData.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/TaskFilterMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlType;
+
+ at XmlType(name = "task-filter")
+public final class TaskFilterMetaData {
+    private List<AbstractTaskFilter> taskFilters;
+    private String directExecutorName;
+
+    public List<AbstractTaskFilter> getTaskFilters() {
+        return taskFilters;
+    }
+
+    @XmlElements({
+        @XmlElement(name = "thread-name", type = ThreadNameFilter.class),
+        @XmlElement(name = "thread-name-notation", type = ThreadNameNotationFilter.class),
+        @XmlElement(name = "log-exceptions", type = LogExceptionsFilter.class),
+        @XmlElement(name = "clear-tls", type = ClearTLSFilter.class),
+        @XmlElement(name = "clear-context-classloader", type = ClearContextClassLoaderFilter.class),
+        @XmlElement(name = "initializer", type = InitializerFilter.class),
+        @XmlElement(name = "cleaner", type = CleanerFilter.class)
+    })
+    public void setTaskFilters(final List<AbstractTaskFilter> taskFilters) {
+        this.taskFilters = taskFilters;
+    }
+
+    public String getDirectExecutorName() {
+        return directExecutorName;
+    }
+
+    @XmlAttribute(name = "direct-executor-name")
+    public void setDirectExecutorName(final String directExecutorName) {
+        this.directExecutorName = directExecutorName;
+    }
+}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadFactoryExecutorMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadFactoryExecutorMetaData.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadFactoryExecutorMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+ at XmlType(name = "thread-factory-executor", propOrder = {})
+public final class ThreadFactoryExecutorMetaData {
+    private RefMetaData threadFactory;
+    private TaskFilterMetaData taskFilter;
+    private ScaledCountMetaData maxThreads;
+    private String name;
+    private boolean blocking = false;
+
+    public RefMetaData getThreadFactory() {
+        return threadFactory;
+    }
+
+    @XmlElement(name = "thread-factory")
+    public void setThreadFactory(final RefMetaData threadFactory) {
+        this.threadFactory = threadFactory;
+    }
+
+    public TaskFilterMetaData getTaskFilter() {
+        return taskFilter;
+    }
+
+    @XmlElement(name = "task-filter")
+    public void setTaskFilter(final TaskFilterMetaData taskFilter) {
+        this.taskFilter = taskFilter;
+    }
+
+    public ScaledCountMetaData getMaxThreads() {
+        return maxThreads;
+    }
+
+    @XmlElement(name = "max-threads")
+    public void setMaxThreads(final ScaledCountMetaData maxThreads) {
+        this.maxThreads = maxThreads;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public boolean isBlocking() {
+        return blocking;
+    }
+
+    @XmlAttribute
+    public void setBlocking(final boolean blocking) {
+        this.blocking = blocking;
+    }
+}

Modified: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadFactoryMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadFactoryMetaData.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadFactoryMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -32,14 +32,14 @@
 @XmlType(name = "thread-factory", propOrder = {})
 public final class ThreadFactoryMetaData {
     private String name;
-    private String group;
     private Boolean daemon;
-    private Integer initialPriority;
-    private Long stackSize;
     private String threadNamePattern = "pool-%f-thread-%t";
-    private ExceptionHandlerRefMetaData exceptionHandler;
-    private InterruptHandlerRefMetaData[] interruptHandlers = new InterruptHandlerRefMetaData[0];
+    private Integer priority;
 
+    private RefMetaData threadGroup;
+    private RefMetaData exceptionHandler;
+    private TaskFilterMetaData taskFilter;
+
     public String getName() {
         return name;
     }
@@ -49,15 +49,6 @@
         this.name = name;
     }
 
-    public String getGroup() {
-        return group;
-    }
-
-    @XmlAttribute
-    public void setGroup(final String group) {
-        this.group = group;
-    }
-
     public Boolean getDaemon() {
         return daemon;
     }
@@ -67,48 +58,48 @@
         this.daemon = daemon;
     }
 
-    public Integer getInitialPriority() {
-        return initialPriority;
+    public String getThreadNamePattern() {
+        return threadNamePattern;
     }
 
-    @XmlAttribute(name = "initial-priority")
-    public void setInitialPriority(final Integer initialPriority) {
-        this.initialPriority = initialPriority;
+    @XmlAttribute(name = "thread-name-pattern")
+    public void setThreadNamePattern(final String threadNamePattern) {
+        this.threadNamePattern = threadNamePattern;
     }
 
-    public Long getStackSize() {
-        return stackSize;
+    public Integer getPriority() {
+        return priority;
     }
 
-    @XmlAttribute(name = "stack-size")
-    public void setStackSize(final Long stackSize) {
-        this.stackSize = stackSize;
+    @XmlAttribute
+    public void setPriority(final Integer priority) {
+        this.priority = priority;
     }
 
-    public String getThreadNamePattern() {
-        return threadNamePattern;
+    public RefMetaData getThreadGroup() {
+        return threadGroup;
     }
 
-    @XmlAttribute(name = "thread-name-pattern")
-    public void setThreadNamePattern(final String threadNamePattern) {
-        this.threadNamePattern = threadNamePattern;
+    @XmlElement(name = "thread-group")
+    public void setThreadGroup(final RefMetaData threadGroup) {
+        this.threadGroup = threadGroup;
     }
 
-    public ExceptionHandlerRefMetaData getExceptionHandler() {
+    public RefMetaData getExceptionHandler() {
         return exceptionHandler;
     }
 
     @XmlElement(name = "exception-handler")
-    public void setExceptionHandler(final ExceptionHandlerRefMetaData exceptionHandler) {
+    public void setExceptionHandler(final RefMetaData exceptionHandler) {
         this.exceptionHandler = exceptionHandler;
     }
 
-    public InterruptHandlerRefMetaData[] getInterruptHandlers() {
-        return interruptHandlers;
+    public TaskFilterMetaData getTaskFilter() {
+        return taskFilter;
     }
 
-    @XmlElement(name = "interrupt-handler")
-    public void setInterruptHandlers(final InterruptHandlerRefMetaData[] interruptHandlers) {
-        this.interruptHandlers = interruptHandlers;
+    @XmlElement(name = "task-filter")
+    public void setTaskFilter(final TaskFilterMetaData taskFilter) {
+        this.taskFilter = taskFilter;
     }
 }

Modified: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadGroupMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadGroupMetaData.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadGroupMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -23,13 +23,14 @@
 package org.jboss.threads.metadata;
 
 import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 
 @XmlType(name = "thread-group", propOrder = {})
 public final class ThreadGroupMetaData {
     private String name;
     private String groupName;
-    private String parent;
+    private RefMetaData parentThreadGroup;
     private Boolean daemon;
     private Integer maxPriority;
 
@@ -46,18 +47,18 @@
         return groupName;
     }
 
-    @XmlAttribute(name = "group-name", required = true)
+    @XmlAttribute(name = "group-name")
     public void setGroupName(final String groupName) {
         this.groupName = groupName;
     }
 
-    public String getParent() {
-        return parent;
+    public RefMetaData getParentThreadGroup() {
+        return parentThreadGroup;
     }
 
-    @XmlAttribute
-    public void setParent(final String parent) {
-        this.parent = parent;
+    @XmlElement(name = "parent-thread-group")
+    public void setParentThreadGroup(final RefMetaData parentThreadGroup) {
+        this.parentThreadGroup = parentThreadGroup;
     }
 
     public Boolean isDaemon() {

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadMetaData.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+ at XmlType(name = "thread", propOrder = {})
+public final class ThreadMetaData {
+    private String name;
+    private Boolean daemon;
+    private Integer priority;
+    private RefMetaData task;
+    private RefMetaData threadFactory;
+    private RefMetaData exceptionHandler;
+    private TaskFilterMetaData taskFilter;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public Boolean isDaemon() {
+        return daemon;
+    }
+
+    @XmlAttribute
+    public void setDaemon(final Boolean daemon) {
+        this.daemon = daemon;
+    }
+
+    public Integer getPriority() {
+        return priority;
+    }
+
+    @XmlAttribute
+    public void setPriority(final Integer priority) {
+        this.priority = priority;
+    }
+
+    public RefMetaData getTask() {
+        return task;
+    }
+
+    @XmlElement(required = true)
+    public void setTask(final RefMetaData task) {
+        this.task = task;
+    }
+
+    public RefMetaData getThreadFactory() {
+        return threadFactory;
+    }
+
+    @XmlElement(name = "thread-factory", required = true)
+    public void setThreadFactory(final RefMetaData threadFactory) {
+        this.threadFactory = threadFactory;
+    }
+
+    public RefMetaData getExceptionHandler() {
+        return exceptionHandler;
+    }
+
+    @XmlElement(name = "exception-handler")
+    public void setExceptionHandler(final RefMetaData exceptionHandler) {
+        this.exceptionHandler = exceptionHandler;
+    }
+
+    public TaskFilterMetaData getTaskFilter() {
+        return taskFilter;
+    }
+
+    @XmlElement(name = "task-filter")
+    public void setTaskFilter(final TaskFilterMetaData taskFilter) {
+        this.taskFilter = taskFilter;
+    }
+}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadNameFilter.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadNameFilter.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadNameFilter.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import java.util.List;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+public final class ThreadNameFilter extends AbstractTaskFilter {
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    protected void addTo(final BeanMetaDataBuilder builder, final List<ValueMetaData> objectList) {
+        objectList.add(builder.createValue(ThreadsHelper.FilterTypes.THREAD_NAME));
+        objectList.add(builder.createValue(name));
+    }
+}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadNameNotationFilter.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadNameNotationFilter.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadNameNotationFilter.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import java.util.List;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+public final class ThreadNameNotationFilter extends AbstractTaskFilter {
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    protected void addTo(final BeanMetaDataBuilder builder, final List<ValueMetaData> objectList) {
+        objectList.add(builder.createValue(ThreadsHelper.FilterTypes.THREAD_NAME_NOTATION));
+        objectList.add(builder.createValue(name));
+    }
+}
\ No newline at end of file

Deleted: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadPoolExecutorMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadPoolExecutorMetaData.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadPoolExecutorMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.metadata;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- *
- */
- at XmlType(name = "thread-pool-executor", propOrder = {})
-public final class ThreadPoolExecutorMetaData {
-    private String name;
-    private String threadFactory;
-    private PoolSizeMetaData corePoolSize;
-    private PoolSizeMetaData maxPoolSize;
-    private TimeMetaData keepAliveTime;
-    private RejectPolicyMetaData rejectPolicyMetaData;
-    private Integer queueLength;
-    private boolean allowCoreTimeout;
-
-    public String getName() {
-        return name;
-    }
-
-    @XmlAttribute(required = true)
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    public String getThreadFactory() {
-        return threadFactory;
-    }
-
-    @XmlAttribute(name = "thread-factory", required = true)
-    public void setThreadFactory(final String threadFactory) {
-        this.threadFactory = threadFactory;
-    }
-
-    public PoolSizeMetaData getCorePoolSize() {
-        return corePoolSize;
-    }
-
-    @XmlElement(name = "core-pool-size")
-    public void setCorePoolSize(final PoolSizeMetaData corePoolSize) {
-        this.corePoolSize = corePoolSize;
-    }
-
-    public PoolSizeMetaData getMaxPoolSize() {
-        return maxPoolSize;
-    }
-
-    @XmlElement(name = "max-pool-size")
-    public void setMaxPoolSize(final PoolSizeMetaData maxPoolSize) {
-        this.maxPoolSize = maxPoolSize;
-    }
-
-    public TimeMetaData getKeepAliveTime() {
-        return keepAliveTime;
-    }
-
-    @XmlElement(name = "keepalive-time")
-    public void setKeepAliveTime(final TimeMetaData keepAliveTime) {
-        this.keepAliveTime = keepAliveTime;
-    }
-
-    public RejectPolicyMetaData getRejectPolicyMetaData() {
-        return rejectPolicyMetaData;
-    }
-
-    @XmlElement(name = "reject-policy")
-    public void setRejectPolicyMetaData(final RejectPolicyMetaData rejectPolicyMetaData) {
-        this.rejectPolicyMetaData = rejectPolicyMetaData;
-    }
-
-    public Integer getQueueLength() {
-        return queueLength;
-    }
-
-    @XmlAttribute(name = "queue-length")
-    public void setQueueLength(final Integer queueLength) {
-        this.queueLength = queueLength;
-    }
-
-    public boolean isAllowCoreTimeout() {
-        return allowCoreTimeout;
-    }
-
-    @XmlAttribute(name = "allow-core-timeout")
-    public void setAllowCoreTimeout(final boolean allowCoreTimeout) {
-        this.allowCoreTimeout = allowCoreTimeout;
-    }
-}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadsHelper.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadsHelper.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadsHelper.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,571 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import org.jboss.aop.microcontainer.aspects.jmx.JMX;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.logging.Logger;
+import org.jboss.threads.ArrayQueue;
+import org.jboss.threads.DirectExecutor;
+import org.jboss.threads.JBossExecutors;
+import org.jboss.threads.JBossThreadFactory;
+import org.jboss.threads.JBossThreadPoolExecutor;
+import org.jboss.threads.OrderedExecutor;
+import org.jboss.threads.QueueExecutor;
+import org.jboss.threads.QueuelessExecutor;
+import org.jboss.threads.management.BoundedQueueThreadPoolExecutorMBean;
+import org.jboss.threads.management.BoundedThreadPoolExecutorMBean;
+import org.jboss.threads.management.ThreadExecutorMBean;
+import org.jboss.threads.management.ThreadPoolExecutorMBean;
+
+import javax.management.ObjectName;
+
+public final class ThreadsHelper {
+
+    private ThreadsHelper() {
+    }
+
+    static final Map<String, String> UNIT_NICK_NAMES = stringMap(
+        entry("S", "SECONDS"),
+        entry("SEC", "SECONDS"),
+        entry("M", "MINUTES"),
+        entry("MIN", "MINUTES"),
+        entry("MS", "MILLISECONDS"),
+        entry("NS", "NANOSECONDS"),
+        entry("H", "HOURS"),
+        entry("D", "DAYS"),
+        entry("MON", "MONTHS"),
+        entry("W", "WEEKS")
+    );
+
+    static Runnable createTaskFilterTask(final List<Object> objects, final Runnable task) {
+        return JBossExecutors.executorTask(createTaskFilter(objects), task);
+    }
+
+    static DirectExecutor createTaskFilter(final List<Object> objects) {
+        return createTaskFilterRecursive(objects.iterator());
+    }
+
+    static DirectExecutor createTaskFilterRecursive(final Iterator<Object> it) {
+        if (! it.hasNext()) {
+            return JBossExecutors.directExecutor();
+        }
+        final Object object = it.next();
+        if (object instanceof DirectExecutor && ! it.hasNext()) {
+            return (DirectExecutor) object;
+        }
+        switch ((FilterTypes) object) {
+            case THREAD_NAME: {
+                final String nextString = (String) it.next();
+                return JBossExecutors.threadNameExecutor(createTaskFilterRecursive(it), nextString);
+            }
+            case THREAD_NAME_NOTATION: {
+                final String nextString = (String) it.next();
+                return JBossExecutors.threadNameNotateExecutor(createTaskFilterRecursive(it), nextString);
+            }
+            case LOG_EXCEPTIONS: {
+                final Logger log = Logger.getLogger((String) it.next());
+                final Logger.Level level = Logger.Level.valueOf((String) it.next());
+                return JBossExecutors.exceptionLoggingExecutor(createTaskFilterRecursive(it), log, level);
+            }
+            case CLEAR_TLS: {
+                return JBossExecutors.resettingExecutor(createTaskFilterRecursive(it));
+            }
+            case CLEAR_CONTEXT_CLASSLOADER: {
+                return JBossExecutors.cleanupExecutor(createTaskFilterRecursive(it), JBossExecutors.contextClassLoaderResetter());
+            }
+            case INITIALIZER: {
+                final Runnable r = (Runnable) it.next();
+                return JBossExecutors.initializingExecutor(createTaskFilterRecursive(it), r);
+            }
+            case CLEANER: {
+                final Runnable r = (Runnable) it.next();
+                return JBossExecutors.cleanupExecutor(createTaskFilterRecursive(it), r);
+            }
+            default: {
+                throw new IllegalStateException();
+            }
+        }
+    }
+
+    static Thread createThread(final ThreadFactory threadFactory, final List<Object> taskFilterObjects, final Runnable task) {
+        return threadFactory.newThread(createTaskFilterTask(taskFilterObjects, task));
+    }
+
+    static ThreadFactory createThreadFactory(final ThreadGroup threadGroup, final Boolean daemon, final Integer priority, final String namePattern, final Thread.UncaughtExceptionHandler exceptionHandler, final Long stackSize, final List<Object> taskFilterObjects) {
+        return JBossExecutors.wrappingThreadFactory(createTaskFilter(taskFilterObjects), new JBossThreadFactory(threadGroup, daemon, priority, namePattern, exceptionHandler, stackSize));
+    }
+
+    static Executor createJBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, List<Object> taskFilterObjects) {
+        return JBossExecutors.wrappingExecutor(createTaskFilter(taskFilterObjects), new JBossThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory));
+    }
+
+    static Executor createThreadFactoryExecutor(final ThreadFactory factory, int maxThreads, boolean blocking, final List<Object> taskFilterObjects) {
+        return JBossExecutors.threadFactoryExecutor(factory, maxThreads, blocking, createTaskFilter(taskFilterObjects));
+    }
+
+    static QueueExecutor createQueueExecutor(final int corePoolSize, final int maxPoolSize, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final Queue<Runnable> queue, final ThreadFactory threadFactory, final boolean blocking, final Executor handoffExecutor, final List<Object> taskFilterObjects) {
+        return new QueueExecutor(corePoolSize, maxPoolSize, keepAliveTime, keepAliveTimeUnit, queue, threadFactory, blocking, handoffExecutor, createTaskFilter(taskFilterObjects)); 
+    }
+
+    static int calculateScaledCount(ScaledCountMetaData poolSizeMetaData) {
+        float count = poolSizeMetaData.getCount();
+        float perCpu = poolSizeMetaData.getPerCpu();
+        if (Float.isNaN(count) || Float.isInfinite(count) || count < 0.0f) {
+            count = 0.0f;
+        }
+        if (Float.isNaN(perCpu) || Float.isInfinite(perCpu) || perCpu < 0.0f) {
+            perCpu = 0.0f;
+        }
+        return Math.round(count + ((float) Runtime.getRuntime().availableProcessors()) * perCpu);
+    }
+
+    private static StringEntry entry(final String key, final String value) {
+        return new StringEntry(key, value);
+    }
+
+    private static Map<String, String> stringMap(StringEntry... entries) {
+        final HashMap<String, String> hashMap = new HashMap<String, String>(entries.length);
+        for (Map.Entry<String, String> e : entries) {
+            hashMap.put(e.getKey(), e.getValue());
+        }
+        return Collections.unmodifiableMap(hashMap);
+    }
+
+    static void addMetaData(final List<BeanMetaData> beanMetaDataList, final ThreadMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder;
+        final RefMetaData threadFactoryRef = metaData.getThreadFactory();
+        builder = BeanMetaDataBuilder.createBuilder(name, Thread.class.getName());
+        final TaskFilterMetaData taskFilter = metaData.getTaskFilter();
+        if (taskFilter != null) {
+            builder.setFactoryClass(ThreadsHelper.class.getName());
+            builder.setFactoryMethod("createThread");
+            builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createInject(threadFactoryRef.getName()));
+            final List<ValueMetaData> objectList = builder.createList(ArrayList.class.getName(), Object.class.getName());
+            for (AbstractTaskFilter filter : taskFilter.getTaskFilters()) {
+                filter.addTo(builder, objectList);
+            }
+            builder.addConstructorParameter(List.class.getName(), (ValueMetaData)objectList);
+            builder.addConstructorParameter(Runnable.class.getName(), builder.createInject(metaData.getTask().getName()));
+        } else {
+            builder.setFactory(builder.createInject(threadFactoryRef.getName()));
+            builder.addConstructorParameter(Runnable.class.getName(), builder.createInject(metaData.getTask().getName()));
+        }
+        final Boolean daemon = metaData.isDaemon();
+        if (daemon != null) {
+            builder.addPropertyMetaData("daemon", daemon);
+        }
+        final Integer priority = metaData.getPriority();
+        if (priority != null) {
+            builder.addPropertyMetaData("priority", priority);
+        }
+        final RefMetaData exceptionHandler = metaData.getExceptionHandler();
+        if (exceptionHandler != null) {
+            builder.addPropertyMetaData("uncaughtExceptionHandler", builder.createInject(exceptionHandler.getName()));
+        }
+        builder.ignoreCreate();
+        builder.setStop("interrupt");
+        builder.ignoreDestroy();
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    static void addMetaData(final List<BeanMetaData> beanMetaDataList, final ThreadGroupMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, ThreadGroup.class.getName());
+        final RefMetaData parentRef = metaData.getParentThreadGroup();
+        if (parentRef != null) {
+            builder.addConstructorParameter(ThreadGroup.class.getName(), builder.createInject(parentRef.getName()));
+        }
+        final String groupName = metaData.getGroupName();
+        builder.addConstructorParameter(String.class.getName(), builder.createValue(groupName != null ? groupName : name));
+        if (metaData.isDaemon() != null) {
+            builder.addPropertyMetaData("daemon", builder.createValue(metaData.isDaemon()));
+        }
+        final Integer maxPriorityMeta = metaData.getMaxPriority();
+        if (maxPriorityMeta != null) {
+            builder.addPropertyMetaData("maxPriority", builder.createValue(maxPriorityMeta));
+        }
+        builder.ignoreCreate();
+        builder.ignoreStart();
+        builder.setStop("interrupt");
+        builder.ignoreDestroy();
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    static void addMetaData(final List<BeanMetaData> beanMetaDataList, final ThreadFactoryMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, JBossThreadFactory.class.getName());
+        builder.ignoreCreate();
+        builder.ignoreStart();
+        builder.ignoreStop();
+        builder.ignoreDestroy();
+        final RefMetaData groupRef = metaData.getThreadGroup();
+        builder.addConstructorParameter(ThreadGroup.class.getName(), groupRef == null ? builder.createNull() : builder.createInject(groupRef.getName()));
+        final Boolean daemon = metaData.getDaemon();
+        builder.addConstructorParameter(Boolean.class.getName(), daemon == null ? builder.createNull() : builder.createValue(daemon));
+        final Integer priorityMeta = metaData.getPriority();
+        final Integer actualPriorityMeta;
+        if (priorityMeta != null) {
+            actualPriorityMeta = priorityMeta;
+        } else {
+            actualPriorityMeta = null;
+        }
+        builder.addConstructorParameter(Integer.class.getName(), actualPriorityMeta == null ? builder.createNull() : builder.createValue(actualPriorityMeta));
+        builder.addConstructorParameter(String.class.getName(), builder.createValue(metaData.getThreadNamePattern()));
+        final RefMetaData exceptionHandler = metaData.getExceptionHandler();
+        builder.addConstructorParameter(Thread.UncaughtExceptionHandler.class.getName(), exceptionHandler == null ? builder.createNull() : builder.createInject(exceptionHandler.getName()));
+        builder.addConstructorParameter(Long.class.getName(), builder.createNull());
+        final TaskFilterMetaData taskFilter = metaData.getTaskFilter();
+        if (taskFilter != null) {
+            builder.setFactoryClass(ThreadsHelper.class.getName());
+            builder.setFactoryMethod("createThreadFactory");
+            final List<ValueMetaData> list = builder.createList(ArrayList.class.getName(), Object.class.getName());
+            for (AbstractTaskFilter filter : taskFilter.getTaskFilters()) {
+                filter.addTo(builder, list);
+            }
+            builder.addConstructorParameter(List.class.getName(), (ValueMetaData) list);
+        }
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    static void addMetaData(final List<BeanMetaData> beanMetaDataList, final ThreadFactoryExecutorMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, Executor.class.getName());
+        builder.ignoreCreate();
+        builder.ignoreStart();
+        builder.ignoreStop();
+        builder.ignoreDestroy();
+        builder.setFactoryClass(JBossExecutors.class.getName());
+        builder.setFactoryMethod("threadFactoryExecutor");
+        final RefMetaData threadFactory = metaData.getThreadFactory();
+        if (threadFactory != null) {
+            builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createInject(threadFactory.getName()));
+        } else {
+            builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createValue(Executors.defaultThreadFactory()));
+        }
+        final ScaledCountMetaData maxThreads = metaData.getMaxThreads();
+        if (maxThreads != null) {
+            builder.addConstructorParameter(Integer.class.getName(), Integer.valueOf(calculateScaledCount(maxThreads)));
+        } else {
+            builder.addConstructorParameter(Integer.class.getName(), Integer.valueOf(1));
+        }
+        builder.addConstructorParameter(Boolean.class.getName(), Boolean.valueOf(metaData.isBlocking()));
+        final TaskFilterMetaData taskFilter = metaData.getTaskFilter();
+        if (taskFilter != null) {
+            builder.setFactoryClass(ThreadsHelper.class.getName());
+            builder.setFactoryMethod("createThreadFactoryExecutor");
+            final List<ValueMetaData> list = builder.createList(ArrayList.class.getName(), Object.class.getName());
+            for (AbstractTaskFilter filter : taskFilter.getTaskFilters()) {
+                filter.addTo(builder, list);
+            }
+            builder.addConstructorParameter(List.class.getName(), (ValueMetaData) list);
+        }
+        builder.addAnnotation(new LiteralJMX(ThreadExecutorMBean.class, "jboss.threads:type=threadFactoryExecutor,name=" + ObjectName.quote(name), false));
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    static void addMetaData(final List<BeanMetaData> beanMetaDataList, final UnboundedQueueThreadPoolExecutorMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, Executor.class.getName());
+        builder.ignoreCreate();
+        builder.ignoreStart();
+        builder.setStop("shutdown");
+        builder.ignoreDestroy();
+        final int coreThreads = calculateScaledCount(metaData.getCoreThreads());
+        builder.addConstructorParameter("int", Integer.valueOf(coreThreads));
+        builder.addConstructorParameter("int", Integer.valueOf(coreThreads));
+        final TimeMetaData keepaliveTime = metaData.getKeepaliveTime();
+        if (keepaliveTime != null) {
+            builder.addConstructorParameter("long", Long.valueOf(keepaliveTime.getTime()));
+            builder.addConstructorParameter(TimeUnit.class.getName(), builder.createValue(TimeUnit.valueOf(UNIT_NICK_NAMES.get(keepaliveTime.getUnit().toUpperCase()))));
+            builder.addPropertyMetaData("allowCoreThreadTimeout", Boolean.TRUE);
+        } else {
+            builder.addConstructorParameter("long", Long.valueOf(Long.MAX_VALUE));
+            builder.addConstructorParameter(TimeUnit.class.getName(), builder.createValue(TimeUnit.SECONDS));
+        }
+        builder.addConstructorParameter(Queue.class.getName(), builder.createValue(new LinkedBlockingQueue<Runnable>()));
+        final RefMetaData threadFactory = metaData.getThreadFactory();
+        if (threadFactory != null) {
+            builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createInject(threadFactory.getName()));
+        } else {
+            builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createValue(Executors.defaultThreadFactory()));
+        }
+        final TaskFilterMetaData taskFilter = metaData.getTaskFilter();
+        if (taskFilter != null) {
+            builder.setFactoryClass(ThreadsHelper.class.getName());
+            builder.setFactoryMethod("createJBossThreadPoolExecutor");
+            final List<ValueMetaData> list = builder.createList(ArrayList.class.getName(), Object.class.getName());
+            for (AbstractTaskFilter filter : taskFilter.getTaskFilters()) {
+                filter.addTo(builder, list);
+            }
+            builder.addConstructorParameter(List.class.getName(), (ValueMetaData) list);
+        }
+        builder.addAnnotation(new LiteralJMX(ThreadPoolExecutorMBean.class, "jboss.threads:type=unboundedQueueThreadPool,name=" + ObjectName.quote(name), false));
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    public static void addMetaData(final List<BeanMetaData> beanMetaDataList, final BoundedQueueThreadPoolExecutorMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, QueueExecutor.class.getName());
+        builder.ignoreCreate();
+        builder.ignoreStart();
+        builder.setStop("shutdown");
+        builder.ignoreDestroy();
+        builder.addConstructorParameter("int", Integer.valueOf(calculateScaledCount(metaData.getCoreThreads())));
+        final ScaledCountMetaData maxThreads = metaData.getMaxThreads();
+        if (maxThreads != null) {
+            builder.addConstructorParameter("int", Integer.valueOf(calculateScaledCount(maxThreads)));
+        }
+        final TimeMetaData keepaliveTime = metaData.getKeepaliveTime();
+        if (keepaliveTime != null) {
+            builder.addConstructorParameter("long", Long.valueOf(keepaliveTime.getTime()));
+            builder.addConstructorParameter(TimeUnit.class.getName(), builder.createValue(TimeUnit.valueOf(UNIT_NICK_NAMES.get(keepaliveTime.getUnit().toUpperCase()))));
+        } else {
+            builder.addConstructorParameter("long", Long.valueOf(Long.MAX_VALUE));
+            builder.addConstructorParameter(TimeUnit.class.getName(), builder.createValue(TimeUnit.SECONDS));
+        }
+        builder.addConstructorParameter(Queue.class.getName(), builder.createValue(new ArrayQueue<Runnable>(calculateScaledCount(metaData.getQueueLength()))));
+        final RefMetaData threadFactory = metaData.getThreadFactory();
+        if (threadFactory != null) {
+            builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createInject(threadFactory.getName()));
+        }
+        builder.addConstructorParameter("boolean", Boolean.valueOf(metaData.isBlocking()));
+        final RefMetaData handoffExecutor = metaData.getHandoffExecutor();
+        if (handoffExecutor != null) {
+            builder.addConstructorParameter(Executor.class.getName(), builder.createInject(handoffExecutor.getName()));
+        } else {
+            builder.addConstructorParameter(Executor.class.getName(), builder.createNull());
+        }
+        if (metaData.isAllowCoreTimeout()) {
+            builder.addPropertyMetaData("allowCoreTimeout", Boolean.TRUE);
+        }
+        final TaskFilterMetaData taskFilter = metaData.getTaskFilter();
+        if (taskFilter != null) {
+            builder.setFactoryClass(ThreadsHelper.class.getName());
+            builder.setFactoryMethod("createQueueExecutor");
+            final List<ValueMetaData> list = builder.createList(ArrayList.class.getName(), Object.class.getName());
+            for (AbstractTaskFilter filter : taskFilter.getTaskFilters()) {
+                filter.addTo(builder, list);
+            }
+            builder.addConstructorParameter(List.class.getName(), (ValueMetaData) list);
+        }
+        builder.addAnnotation(new LiteralJMX(BoundedQueueThreadPoolExecutorMBean.class, "jboss.threads:type=boundedQueueThreadPool,name=" + ObjectName.quote(name), false));
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    public static void addMetaData(final List<BeanMetaData> beanMetaDataList, final QueuelessThreadPoolExecutorMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, QueuelessExecutor.class.getName());
+        builder.ignoreCreate();
+        builder.ignoreStart();
+        builder.setStop("shutdown");
+        builder.ignoreDestroy();
+        final RefMetaData threadFactory = metaData.getThreadFactory();
+        if (threadFactory != null) {
+            builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createInject(threadFactory.getName()));
+        } else {
+            builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createValue(Executors.defaultThreadFactory()));
+        }
+        final TaskFilterMetaData taskFilter = metaData.getTaskFilter();
+        if (taskFilter != null) {
+            builder.setFactoryClass(ThreadsHelper.class.getName());
+            builder.setFactoryMethod("createQueueExecutor");
+            final List<ValueMetaData> list = builder.createList(ArrayList.class.getName(), Object.class.getName());
+            for (AbstractTaskFilter filter : taskFilter.getTaskFilters()) {
+                filter.addTo(builder, list);
+            }
+            builder.addConstructorParameter(List.class.getName(), (ValueMetaData) list);
+        } else {
+            builder.addConstructorParameter(DirectExecutor.class.getName(), builder.createValue(JBossExecutors.directExecutor()));
+        }
+        final RefMetaData handoffExecutor = metaData.getHandoffExecutor();
+        if (handoffExecutor != null) {
+            builder.addConstructorParameter(Executor.class.getName(), builder.createInject(handoffExecutor.getName()));
+        } else {
+            builder.addConstructorParameter(Executor.class.getName(), builder.createNull());
+        }
+        final TimeMetaData keepaliveTime = metaData.getKeepaliveTime();
+        if (keepaliveTime != null) {
+            final TimeUnit unit = TimeUnit.valueOf(UNIT_NICK_NAMES.get(keepaliveTime.getUnit().toUpperCase()));
+            builder.addConstructorParameter("long", builder.createValue(Long.valueOf(unit.toMillis(keepaliveTime.getTime()))));
+        } else {
+            builder.addConstructorParameter("long", builder.createValue(Long.valueOf(Long.MAX_VALUE)));
+        }
+        builder.addAnnotation(new LiteralJMX(BoundedThreadPoolExecutorMBean.class, "jboss.threads:type=queuelessThreadPool,name=" + ObjectName.quote(name), false));
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    public static void addMetaData(final List<BeanMetaData> beanMetaDataList, final ScheduledThreadPoolExecutorMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, QueuelessExecutor.class.getName());
+        builder.ignoreCreate();
+        builder.ignoreStart();
+        builder.setStop("shutdown");
+        builder.ignoreDestroy();
+        final ScaledCountMetaData coreThreads = metaData.getCoreThreads();
+        builder.addConstructorParameter("int", Integer.valueOf(calculateScaledCount(coreThreads)));
+        final RefMetaData threadFactory = metaData.getThreadFactory();
+        if (threadFactory != null) {
+            builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createInject(threadFactory.getName()));
+        } else {
+            builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createValue(Executors.defaultThreadFactory()));
+        }
+        final TimeMetaData keepaliveTime = metaData.getKeepaliveTime();
+        if (keepaliveTime != null) {
+            final TimeUnit unit = TimeUnit.valueOf(UNIT_NICK_NAMES.get(keepaliveTime.getUnit().toUpperCase()));
+            builder.addPropertyMetaData("keepAliveTime", builder.createValue(Long.valueOf(unit.toMillis(keepaliveTime.getTime()))));
+        }
+        final TaskFilterMetaData taskFilter = metaData.getTaskFilter();
+        if (taskFilter != null) {
+            throw new UnsupportedOperationException("task-filter not yet supported on scheduled-thread-pool-executor");
+        }
+        builder.addAnnotation(new LiteralJMX(ThreadPoolExecutorMBean.class, "jboss.threads:type=scheduledThreadPool,name=" + ObjectName.quote(name), false));
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    public static void addMetaData(final List<BeanMetaData> beanMetaDataList, final UnboundedOrderedExecutorMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, OrderedExecutor.class.getName());
+        builder.ignoreCreate();
+        builder.ignoreStart();
+        builder.ignoreStop();
+        builder.ignoreDestroy();
+        builder.addConstructorParameter(Executor.class.getName(), builder.createInject(metaData.getParentExecutor().getName()));
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    public static void addMetaData(final List<BeanMetaData> beanMetaDataList, final BoundedOrderedExecutorMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, OrderedExecutor.class.getName());
+        builder.ignoreCreate();
+        builder.ignoreStart();
+        builder.ignoreStop();
+        builder.ignoreDestroy();
+        builder.addConstructorParameter(Executor.class.getName(), builder.createInject(metaData.getParentExecutor().getName()));
+        builder.addConstructorParameter("int", Integer.valueOf(calculateScaledCount(metaData.getQueueLength())));
+        builder.addConstructorParameter("boolean", Boolean.valueOf(metaData.isBlocking()));
+        final RefMetaData handoffExecutor = metaData.getHandoffExecutor();
+        builder.addConstructorParameter(Executor.class.getName(), handoffExecutor != null ? builder.createInject(handoffExecutor.getName()) : builder.createNull());
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    public static void addMetaData(final List<BeanMetaData> beanMetaDataList, final DirectExecutorMetaData metaData) {
+        final String name = metaData.getName();
+        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, DirectExecutor.class.getName());
+        builder.ignoreCreate();
+        builder.ignoreStart();
+        builder.ignoreStop();
+        builder.ignoreDestroy();
+        final TaskFilterMetaData taskFilter = metaData.getTaskFilter();
+        if (taskFilter != null) {
+            builder.setFactoryClass(ThreadsHelper.class.getName());
+            builder.setFactoryMethod("createTaskFilter");
+            final List<ValueMetaData> list = builder.createList(ArrayList.class.getName(), Object.class.getName());
+            for (AbstractTaskFilter filter : taskFilter.getTaskFilters()) {
+                filter.addTo(builder, list);
+            }
+            builder.addConstructorParameter(List.class.getName(), (ValueMetaData) list);
+        } else {
+            builder.setFactoryClass(JBossExecutors.class.getName());
+            builder.setFactoryMethod("directExecutor");
+        }
+        beanMetaDataList.add(builder.getBeanMetaData());
+    }
+
+    enum FilterTypes {
+        THREAD_NAME,
+        THREAD_NAME_NOTATION,
+        LOG_EXCEPTIONS,
+        CLEAR_TLS,
+        CLEAR_CONTEXT_CLASSLOADER,
+        INITIALIZER,
+        CLEANER,
+    }
+
+    private static final class StringEntry implements Map.Entry<String, String> {
+        private final String key;
+        private final String value;
+
+        private StringEntry(final String key, final String value) {
+            this.key = key;
+            this.value = value;
+        }
+
+        public String getKey() {
+            return key;
+        }
+
+        public String getValue() {
+            return value;
+        }
+
+        public String setValue(final String value) {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    private static class LiteralJMX implements JMX {
+        private final Class<?> exposedInterface;
+        private final String name;
+        private final boolean registerDirectly;
+
+        private LiteralJMX(final Class<?> exposedInterface, final String name, final boolean registerDirectly) {
+            this.exposedInterface = exposedInterface;
+            this.name = name;
+            this.registerDirectly = registerDirectly;
+        }
+
+        public Class<?> exposedInterface() {
+            return exposedInterface;
+        }
+
+        public String name() {
+            return name;
+        }
+
+        public boolean registerDirectly() {
+            return registerDirectly;
+        }
+
+        public Class<? extends Annotation> annotationType() {
+            return JMX.class;
+        }
+    }
+}

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	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/ThreadsMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -24,38 +24,9 @@
 
 import java.util.List;
 import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-import java.util.Queue;
-import java.util.LinkedList;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.RejectedExecutionHandler;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ArrayBlockingQueue;
-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;
 import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.threads.JBossThreadFactory;
-import org.jboss.threads.InterruptHandler;
-import org.jboss.threads.SimpleQueueExecutor;
-import org.jboss.threads.JBossExecutors;
-import org.jboss.threads.RejectionPolicy;
-import org.jboss.threads.ArrayQueue;
-import org.jboss.threads.JBossThreadPoolExecutor;
-import org.jboss.threads.DirectExecutor;
-import org.jboss.threads.ThreadPoolExecutorMBean;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.aop.microcontainer.aspects.jmx.JMX;
 
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlNsForm;
@@ -66,64 +37,32 @@
 /**
  *
  */
- at JBossXmlSchema(namespace = "urn:jboss:threads:1.0", elementFormDefault = XmlNsForm.QUALIFIED)
+ at JBossXmlSchema(namespace = "urn:jboss:threads:2.0", elementFormDefault = XmlNsForm.QUALIFIED)
 @XmlRootElement(name = "threads")
 @XmlType(name = "threads", propOrder = {})
 public final class ThreadsMetaData implements BeanMetaDataFactory {
-    private static final class StringEntry implements Map.Entry<String, String> {
-        private final String key;
-        private final String value;
 
-        private StringEntry(final String key, final String value) {
-            this.key = key;
-            this.value = value;
-        }
+    private List<ThreadMetaData> threads = new ArrayList<ThreadMetaData>();
+    private List<ThreadGroupMetaData> threadGroups = new ArrayList<ThreadGroupMetaData>();
+    private List<ThreadFactoryMetaData> threadFactories = new ArrayList<ThreadFactoryMetaData>();
+    private List<ThreadFactoryExecutorMetaData> threadFactoryExecutors = new ArrayList<ThreadFactoryExecutorMetaData>();
+    private List<UnboundedQueueThreadPoolExecutorMetaData> unboundedQueueThreadPoolExecutors = new ArrayList<UnboundedQueueThreadPoolExecutorMetaData>();
+    private List<BoundedQueueThreadPoolExecutorMetaData> boundedQueueThreadPoolExecutors = new ArrayList<BoundedQueueThreadPoolExecutorMetaData>();
+    private List<QueuelessThreadPoolExecutorMetaData> queuelessThreadPoolExecutors = new ArrayList<QueuelessThreadPoolExecutorMetaData>();
+    private List<ScheduledThreadPoolExecutorMetaData> scheduledThreadPoolExecutors = new ArrayList<ScheduledThreadPoolExecutorMetaData>();
+    private List<UnboundedOrderedExecutorMetaData> unboundedOrderedExecutors = new ArrayList<UnboundedOrderedExecutorMetaData>();
+    private List<BoundedOrderedExecutorMetaData> boundedOrderedExecutors = new ArrayList<BoundedOrderedExecutorMetaData>();
+    private List<DirectExecutorMetaData> directExecutors = new ArrayList<DirectExecutorMetaData>();
 
-        public String getKey() {
-            return key;
-        }
-
-        public String getValue() {
-            return value;
-        }
-
-        public String setValue(final String value) {
-            throw new UnsupportedOperationException();
-        }
+    public List<ThreadMetaData> getThreads() {
+        return threads;
     }
 
-    private static StringEntry entry(final String key, final String value) {
-        return new StringEntry(key, value);
+    @XmlElement(name = "thread")
+    public void setThreads(final List<ThreadMetaData> threads) {
+        this.threads = threads;
     }
 
-    private static Map<String, String> stringMap(StringEntry... entries) {
-        final HashMap<String, String> hashMap = new HashMap<String, String>(entries.length);
-        for (Map.Entry<String, String> e : entries) {
-            hashMap.put(e.getKey(), e.getValue());
-        }
-        return Collections.unmodifiableMap(hashMap);
-    }
-
-    private static final Map<String, String> UNIT_NICK_NAMES = stringMap(
-            entry("S", "SECONDS"),
-            entry("SEC", "SECONDS"),
-            entry("M", "MINUTES"),
-            entry("MIN", "MINUTES"),
-            entry("MS", "MILLISECONDS"),
-            entry("NS", "NANOSECONDS"),
-            entry("H", "HOURS"),
-            entry("D", "DAYS"),
-            entry("MON", "MONTHS"),
-            entry("W", "WEEKS")
-    );
-
-    private List<ThreadGroupMetaData> threadGroups = new ArrayList<ThreadGroupMetaData>();
-    private List<ThreadFactoryMetaData> threadFactories = new ArrayList<ThreadFactoryMetaData>();
-    private List<ThreadPoolExecutorMetaData> threadPoolExecutors = new ArrayList<ThreadPoolExecutorMetaData>();
-    private List<DirectExecutorMetaData> directExecutors = new ArrayList<DirectExecutorMetaData>();
-    private List<NotatingExecutorMetaData> notatingExecutors = new ArrayList<NotatingExecutorMetaData>();
-    private List<ScheduledThreadPoolExecutorMetaData> scheduledThreadPoolExecutors = new ArrayList<ScheduledThreadPoolExecutorMetaData>();
-
     public List<ThreadGroupMetaData> getThreadGroups() {
         return threadGroups;
     }
@@ -142,33 +81,42 @@
         this.threadFactories = threadFactories;
     }
 
-    public List<ThreadPoolExecutorMetaData> getThreadPoolExecutors() {
-        return threadPoolExecutors;
+    public List<ThreadFactoryExecutorMetaData> getThreadFactoryExecutors() {
+        return threadFactoryExecutors;
     }
 
-    @XmlElement(name = "thread-pool-executor")
-    public void setThreadPoolExecutors(final List<ThreadPoolExecutorMetaData> threadPoolExecutors) {
-        this.threadPoolExecutors = threadPoolExecutors;
+    @XmlElement(name = "thread-factory-executor")
+    public void setThreadFactoryExecutors(final List<ThreadFactoryExecutorMetaData> threadFactoryExecutors) {
+        this.threadFactoryExecutors = threadFactoryExecutors;
     }
 
-    public List<DirectExecutorMetaData> getDirectExecutors() {
-        return directExecutors;
+    public List<UnboundedQueueThreadPoolExecutorMetaData> getUnboundedQueueThreadPoolExecutors() {
+        return unboundedQueueThreadPoolExecutors;
     }
 
-    @XmlElement(name = "direct-executor")
-    public void setDirectExecutors(final List<DirectExecutorMetaData> directExecutors) {
-        this.directExecutors = directExecutors;
+    @XmlElement(name = "unbounded-queue-thread-pool-executor")
+    public void setUnboundedQueueThreadPoolExecutors(final List<UnboundedQueueThreadPoolExecutorMetaData> unboundedQueueThreadPoolExecutors) {
+        this.unboundedQueueThreadPoolExecutors = unboundedQueueThreadPoolExecutors;
     }
 
-    public List<NotatingExecutorMetaData> getNotatingExecutors() {
-        return notatingExecutors;
+    public List<BoundedQueueThreadPoolExecutorMetaData> getBoundedQueueThreadPoolExecutors() {
+        return boundedQueueThreadPoolExecutors;
     }
 
-    @XmlElement(name = "notating-executor")
-    public void setNotatingExecutors(final List<NotatingExecutorMetaData> notatingExecutors) {
-        this.notatingExecutors = notatingExecutors;
+    @XmlElement(name = "bounded-queue-thread-pool-executor")
+    public void setBoundedQueueThreadPoolExecutors(final List<BoundedQueueThreadPoolExecutorMetaData> boundedQueueThreadPoolExecutors) {
+        this.boundedQueueThreadPoolExecutors = boundedQueueThreadPoolExecutors;
     }
 
+    public List<QueuelessThreadPoolExecutorMetaData> getQueuelessThreadPoolExecutors() {
+        return queuelessThreadPoolExecutors;
+    }
+
+    @XmlElement(name = "queueless-thread-pool-executor")
+    public void setQueuelessThreadPoolExecutors(final List<QueuelessThreadPoolExecutorMetaData> queuelessThreadPoolExecutors) {
+        this.queuelessThreadPoolExecutors = queuelessThreadPoolExecutors;
+    }
+
     public List<ScheduledThreadPoolExecutorMetaData> getScheduledThreadPoolExecutors() {
         return scheduledThreadPoolExecutors;
     }
@@ -178,262 +126,69 @@
         this.scheduledThreadPoolExecutors = scheduledThreadPoolExecutors;
     }
 
+    public List<UnboundedOrderedExecutorMetaData> getUnboundedOrderedExecutors() {
+        return unboundedOrderedExecutors;
+    }
+
+    @XmlElement(name = "unbounded-ordered-executor")
+    public void setUnboundedOrderedExecutors(final List<UnboundedOrderedExecutorMetaData> unboundedOrderedExecutors) {
+        this.unboundedOrderedExecutors = unboundedOrderedExecutors;
+    }
+
+    public List<BoundedOrderedExecutorMetaData> getBoundedOrderedExecutors() {
+        return boundedOrderedExecutors;
+    }
+
+    @XmlElement(name = "bounded-ordered-executor")
+    public void setBoundedOrderedExecutors(final List<BoundedOrderedExecutorMetaData> boundedOrderedExecutors) {
+        this.boundedOrderedExecutors = boundedOrderedExecutors;
+    }
+
+    public List<DirectExecutorMetaData> getDirectExecutors() {
+        return directExecutors;
+    }
+
+    @XmlElement(name = "direct-executor")
+    public void setDirectExecutors(final List<DirectExecutorMetaData> directExecutors) {
+        this.directExecutors = directExecutors;
+    }
+
     @XmlTransient
     public List<BeanMetaData> getBeans() {
         List<BeanMetaData> beanMetaDataList = new ArrayList<BeanMetaData>();
+        for (ThreadMetaData metaData : threads) {
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
+        }
         for (ThreadGroupMetaData metaData : threadGroups) {
-            final String name = metaData.getName();
-            final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, ThreadGroup.class.getName());
-            builder.setMode(ControllerMode.ON_DEMAND);
-            final String parent = metaData.getParent();
-            if (parent != null && parent.length() > 0) {
-                builder.addConstructorParameter(ThreadGroup.class.getName(), builder.createInject(parent));
-            }
-            builder.addConstructorParameter(String.class.getName(), builder.createValue(name));
-            if (metaData.isDaemon() != null) {
-                builder.addPropertyMetaData("daemon", builder.createValue(metaData.isDaemon()));
-            }
-            final Integer maxPriorityMeta = metaData.getMaxPriority();
-            if (maxPriorityMeta != null) {
-                builder.addPropertyMetaData("maxPriority", builder.createValue(maxPriorityMeta));
-            }
-            builder.ignoreStop();
-            builder.ignoreDestroy();
-            beanMetaDataList.add(builder.getBeanMetaData());
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
         }
         for (ThreadFactoryMetaData metaData : threadFactories) {
-            final String name = metaData.getName();
-            final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, JBossThreadFactory.class.getName());
-            builder.setMode(ControllerMode.ON_DEMAND);
-            final String group = metaData.getGroup();
-            builder.addConstructorParameter(ThreadGroup.class.getName(), group == null ? builder.createNull() : builder.createInject(group));
-            final Boolean daemon = metaData.getDaemon();
-            builder.addConstructorParameter(Boolean.class.getName(), daemon == null ? builder.createNull() : builder.createValue(daemon));
-            final Integer priorityMeta = metaData.getInitialPriority();
-            final Integer actualPriorityMeta;
-            if (priorityMeta != null) {
-                actualPriorityMeta = priorityMeta;
-            } else {
-                actualPriorityMeta = null;
-            }
-            builder.addConstructorParameter(Integer.class.getName(), actualPriorityMeta == null ? builder.createNull() : builder.createValue(actualPriorityMeta));
-            builder.addConstructorParameter(String.class.getName(), builder.createValue(metaData.getThreadNamePattern()));
-            final List<ValueMetaData> interruptHandlers = builder.createArray(InterruptHandler[].class.getName(), InterruptHandler.class.getName());
-            for (InterruptHandlerRefMetaData ihmd : metaData.getInterruptHandlers()) {
-                interruptHandlers.add(builder.createInject(ihmd.getName()));
-            }
-            builder.addConstructorParameter(InterruptHandler[].class.getName(), (ValueMetaData) interruptHandlers);
-            final ExceptionHandlerRefMetaData ehmd = metaData.getExceptionHandler();
-            builder.addConstructorParameter(Thread.UncaughtExceptionHandler.class.getName(), ehmd == null ? builder.createNull() : builder.createInject(ehmd.getName()));
-            final Long stackSize = metaData.getStackSize();
-            builder.addConstructorParameter(Long.class.getName(), stackSize == null ? builder.createNull() : builder.createValue(stackSize));
-            beanMetaDataList.add(builder.getBeanMetaData());
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
         }
-        for (ThreadPoolExecutorMetaData metaData : threadPoolExecutors) {
-            final String name = metaData.getName();
-            final PoolSizeMetaData corePoolSizeMetaData = metaData.getCorePoolSize();
-            final int corePoolSize;
-            if (corePoolSizeMetaData == null) {
-                corePoolSize = 0;
-            } else {
-                corePoolSize = max(calcPoolSize(corePoolSizeMetaData), 0);
-            }
-            final PoolSizeMetaData maxPoolSizeMetaData = metaData.getMaxPoolSize();
-            final int maxPoolSize;
-            if (maxPoolSizeMetaData == null) {
-                maxPoolSize = max(corePoolSize, 1);
-            } else {
-                maxPoolSize = max(calcPoolSize(maxPoolSizeMetaData), max(1, corePoolSize));
-            }
-            final TimeMetaData timeMetaData = metaData.getKeepAliveTime();
-            final long time;
-            final TimeUnit unit;
-            if (timeMetaData == null) {
-                time = Long.MAX_VALUE;
-                unit = TimeUnit.NANOSECONDS;
-            } else {
-                time = max(0L, timeMetaData.getTime());
-                final String unitName = timeMetaData.getUnit();
-
-                if (unitName == null) {
-                    unit = TimeUnit.MILLISECONDS;
-                } else {
-                    final String upperUnitName = unitName.toUpperCase();
-                    if (UNIT_NICK_NAMES.containsKey(upperUnitName)) {
-                        unit = TimeUnit.valueOf(UNIT_NICK_NAMES.get(upperUnitName));
-                    } else {
-                        unit = TimeUnit.valueOf(upperUnitName);
-                    }
-                }
-            }
-            final String threadFactory = metaData.getThreadFactory();
-            if (threadFactory == null) {
-                throw new IllegalArgumentException("threadFactory is not defined");
-            }
-            final Integer queueLength = metaData.getQueueLength();
-            final RejectPolicyMetaData rejectPolicyMetaData = metaData.getRejectPolicyMetaData();
-            final String policyName = rejectPolicyMetaData == null ? "block" : rejectPolicyMetaData.getName();
-            final BeanMetaDataBuilder executorBuilder;
-            // here is where we decide which thread pool implementation to use
-            // right now, our criteria is simple - if blocking is desired or if core threads can time out, use the queue executor instead
-            if (metaData.isAllowCoreTimeout() || "block".equals(policyName)) {
-                // use SimpleQueueExecutor
-                executorBuilder = BeanMetaDataBuilder.createBuilder(SimpleQueueExecutor.class.getName());
-                final RejectionPolicy rejectionPolicy;
-                final ValueMetaData handoffExecutorValue;
-                if ("abort".equals(policyName)) {
-                    rejectionPolicy = RejectionPolicy.ABORT;
-                    handoffExecutorValue = executorBuilder.createNull();
-                } else if ("block".equals(policyName)) {
-                    rejectionPolicy = RejectionPolicy.BLOCK;
-                    handoffExecutorValue = executorBuilder.createNull();
-                } else if ("caller-runs".equals(policyName)) {
-                    rejectionPolicy = RejectionPolicy.HANDOFF;
-                    handoffExecutorValue = executorBuilder.createValue(JBossExecutors.directExecutor());
-                } else if ("discard".equals(policyName)) {
-                    rejectionPolicy = RejectionPolicy.DISCARD;
-                    handoffExecutorValue = executorBuilder.createNull();
-                } else if ("discard-oldest".equals(policyName)) {
-                    rejectionPolicy = RejectionPolicy.DISCARD_OLDEST;
-                    handoffExecutorValue = executorBuilder.createNull();
-                } else if ("handoff".equals(policyName)) {
-                    rejectionPolicy = RejectionPolicy.HANDOFF;
-                    handoffExecutorValue = executorBuilder.createInject(rejectPolicyMetaData.getExecutorName());
-                } else {
-                    throw new IllegalStateException();
-                }
-                final Queue<Runnable> queue;
-                if (queueLength == null) {
-                    queue = new LinkedList<Runnable>();
-                } 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));
-                executorBuilder.addConstructorParameter(TimeUnit.class.getName(), unit);
-                executorBuilder.addConstructorParameter(Queue.class.getName(), executorBuilder.createValue(queue));
-                executorBuilder.addConstructorParameter(ThreadFactory.class.getName(), executorBuilder.createInject(threadFactory));
-                executorBuilder.addConstructorParameter(RejectionPolicy.class.getName(), rejectionPolicy);
-                executorBuilder.addConstructorParameter(Executor.class.getName(), handoffExecutorValue);
-                if (metaData.isAllowCoreTimeout()) {
-                    executorBuilder.addPropertyMetaData("allowCoreThreadTimeout", Boolean.TRUE);
-                }
-            } else {
-                // use ThreadPoolExecutor
-                executorBuilder = BeanMetaDataBuilder.createBuilder(JBossThreadPoolExecutor.class.getName());
-                final ValueMetaData policyValue;
-                if ("abort".equals(policyName)) {
-                    policyValue = executorBuilder.createValue(JBossExecutors.abortPolicy());
-                } else if ("block".equals(policyName)) {
-                    throw new IllegalStateException();
-                } else if ("caller-runs".equals(policyName)) {
-                    policyValue = executorBuilder.createValue(JBossExecutors.callerRunsPolicy());
-                } else if ("discard".equals(policyName)) {
-                    policyValue = executorBuilder.createValue(JBossExecutors.discardPolicy());
-                } else if ("discard-oldest".equals(policyName)) {
-                    policyValue = executorBuilder.createValue(JBossExecutors.discardOldestPolicy());
-                } else if ("handoff".equals(policyName)) {
-                    final BeanMetaDataBuilder policyBuilder = BeanMetaDataBuilder.createBuilder(RejectedExecutionHandler.class.getName());
-                    policyBuilder.setFactoryClass(JBossExecutors.class.getName());
-                    policyBuilder.setFactoryMethod("handoffPolicy");
-                    policyBuilder.addConstructorParameter(Executor.class.getName(), policyBuilder.createInject(rejectPolicyMetaData.getExecutorName()));
-                    policyValue = policyBuilder.getBeanMetaData();
-                } else {
-                    throw new IllegalStateException();
-                }
-                final BlockingQueue<Runnable> queue;
-                if (queueLength == null) {
-                    // todo: try LinkedTransferQueue
-                    queue = new LinkedBlockingQueue<Runnable>();
-                } 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));
-                executorBuilder.addConstructorParameter(TimeUnit.class.getName(), unit);
-                executorBuilder.addConstructorParameter(BlockingQueue.class.getName(), executorBuilder.createValue(queue));
-                executorBuilder.addConstructorParameter(ThreadFactory.class.getName(), executorBuilder.createInject(threadFactory));
-                executorBuilder.addConstructorParameter(RejectedExecutionHandler.class.getName(), policyValue);
-            }
-            executorBuilder.addAnnotation(new JMX() {
-                public Class<?> exposedInterface() {
-                    return ThreadPoolExecutorMBean.class;
-                }
-
-                public String name() {
-                    return "jboss.threads:service=ThreadPoolExecutor,name=" + name;
-                }
-
-                public boolean registerDirectly() {
-                    return false;
-                }
-
-                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());
-//            builder.setFactoryMethod("protectedExecutorService");
-//            builder.addConstructorParameter(Executor.class.getName(), executorBuilder.getBeanMetaData());
-//            builder.setMode(ControllerMode.ON_DEMAND);
-//            beanMetaDataList.add(builder.getBeanMetaData());
-            executorBuilder.setName(name);
-            beanMetaDataList.add(executorBuilder.getBeanMetaData());
+        for (ThreadFactoryExecutorMetaData metaData : threadFactoryExecutors) {
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
         }
-        for (DirectExecutorMetaData metaData : directExecutors) {
-            final String name = metaData.getName();
-            final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, ExecutorService.class.getName());
-            builder.setFactoryClass(JBossExecutors.class.getName());
-            builder.setFactoryMethod("directExecutorService");
-            builder.setMode(ControllerMode.ON_DEMAND);
-            beanMetaDataList.add(builder.getBeanMetaData());
+        for (UnboundedQueueThreadPoolExecutorMetaData metaData : unboundedQueueThreadPoolExecutors) {
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
         }
-        for (NotatingExecutorMetaData metaData : notatingExecutors) {
-            final String name = metaData.getName();
-            final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, DirectExecutor.class.getName());
-            builder.setMode(ControllerMode.ON_DEMAND);
-            builder.setFactoryClass(JBossExecutors.class.getName());
-            builder.setFactoryMethod("notatingExecutor");
-            builder.addConstructorParameter(Executor.class.getName(), builder.createInject(metaData.getParent()));
-            builder.addConstructorParameter(String.class.getName(), metaData.getNote());
-            beanMetaDataList.add(builder.getBeanMetaData());
+        for (BoundedQueueThreadPoolExecutorMetaData metaData : boundedQueueThreadPoolExecutors) {
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
         }
+        for (QueuelessThreadPoolExecutorMetaData metaData : queuelessThreadPoolExecutors) {
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
+        }
         for (ScheduledThreadPoolExecutorMetaData metaData : scheduledThreadPoolExecutors) {
-            final String name = metaData.getName();
-            final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, ScheduledThreadPoolExecutor.class.getName());
-            builder.setMode(ControllerMode.ON_DEMAND);
-            final PoolSizeMetaData poolSizeMetaData = metaData.getPoolSize();
-            final int size;
-            if (poolSizeMetaData != null) {
-                size = max(1, calcPoolSize(poolSizeMetaData));
-            } else {
-                size = 1;
-            }
-            builder.addConstructorParameter("int", Integer.valueOf(size));
-            final String threadFactoryName = metaData.getThreadFactory();
-            if (threadFactoryName != null) {
-                builder.addConstructorParameter(ThreadFactory.class.getName(), builder.createInject(threadFactoryName));
-            }
-            beanMetaDataList.add(builder.getBeanMetaData());
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
         }
-        return beanMetaDataList;
-    }
-
-    private static int calcPoolSize(PoolSizeMetaData poolSizeMetaData) {
-        float count = poolSizeMetaData.getCount();
-        float perCpu = poolSizeMetaData.getPerCpu();
-        if (Float.isNaN(count) || Float.isInfinite(count) || count < 0.0f) {
-            count = 0.0f;
+        for (UnboundedOrderedExecutorMetaData metaData : unboundedOrderedExecutors) {
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
         }
-        if (Float.isNaN(perCpu) || Float.isInfinite(perCpu) || perCpu < 0.0f) {
-            perCpu = 0.0f;
+        for (BoundedOrderedExecutorMetaData metaData : boundedOrderedExecutors) {
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
         }
-        return Math.round(count + ((float) Runtime.getRuntime().availableProcessors()) * perCpu);
+        for (DirectExecutorMetaData metaData : directExecutors) {
+            ThreadsHelper.addMetaData(beanMetaDataList, metaData);
+        }
+        return beanMetaDataList;
     }
 }

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/UnboundedOrderedExecutorMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/UnboundedOrderedExecutorMetaData.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/UnboundedOrderedExecutorMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+ at XmlType(name = "unbounded-ordered-executor")
+public final class UnboundedOrderedExecutorMetaData {
+    private String name;
+    private RefMetaData parentExecutor;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public RefMetaData getParentExecutor() {
+        return parentExecutor;
+    }
+
+    @XmlElement(name = "parent-executor", required = true)
+    public void setParentExecutor(final RefMetaData parentExecutor) {
+        this.parentExecutor = parentExecutor;
+    }
+}

Added: projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/UnboundedQueueThreadPoolExecutorMetaData.java
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/UnboundedQueueThreadPoolExecutorMetaData.java	                        (rev 0)
+++ projects/jboss-threads/trunk/jbossmc/src/main/java/org/jboss/threads/metadata/UnboundedQueueThreadPoolExecutorMetaData.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+ at XmlType(name = "unbounded-queue-thread-pool-executor", propOrder = {})
+public final class UnboundedQueueThreadPoolExecutorMetaData {
+    private String name;
+    private ScaledCountMetaData coreThreads;
+    private TimeMetaData keepaliveTime;
+    private TaskFilterMetaData taskFilter;
+    private RefMetaData threadFactory;
+
+    public String getName() {
+        return name;
+    }
+
+    @XmlAttribute(required = true)
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public ScaledCountMetaData getCoreThreads() {
+        return coreThreads;
+    }
+
+    @XmlElement(name = "core-threads", required = true)
+    public void setCoreThreads(final ScaledCountMetaData coreThreads) {
+        this.coreThreads = coreThreads;
+    }
+
+    public TimeMetaData getKeepaliveTime() {
+        return keepaliveTime;
+    }
+
+    @XmlElement(name = "keepalive-time")
+    public void setKeepaliveTime(final TimeMetaData keepaliveTime) {
+        this.keepaliveTime = keepaliveTime;
+    }
+
+    public TaskFilterMetaData getTaskFilter() {
+        return taskFilter;
+    }
+
+    @XmlElement(name = "task-filter")
+    public void setTaskFilter(final TaskFilterMetaData taskFilter) {
+        this.taskFilter = taskFilter;
+    }
+
+    public RefMetaData getThreadFactory() {
+        return threadFactory;
+    }
+
+    @XmlElement(name = "thread-factory")
+    public void setThreadFactory(final RefMetaData threadFactory) {
+        this.threadFactory = threadFactory;
+    }
+}

Modified: projects/jboss-threads/trunk/jbossmc/src/main/resources/schema/jboss-threads_2_0.xsd
===================================================================
--- projects/jboss-threads/trunk/jbossmc/src/main/resources/schema/jboss-threads_2_0.xsd	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/jbossmc/src/main/resources/schema/jboss-threads_2_0.xsd	2010-01-13 19:57:37 UTC (rev 99355)
@@ -64,10 +64,10 @@
                 The optional "daemon" attribute specifies whether it is a daemon or non-daemon thread (not
                 specifying this attribute will cause the thread to inherit the daemon status from
                 its thread factory).  The optional "priority" attribute can be used to specify the priority of
-                the thread.  The optional "thread-name-pattern" attribute specifies the name for this thread.
+                the thread.
 
                 The "task" element specifies the Runnable task for the new thread.
-                The optional "thread-factory" element specifies the bean name of a specific thread factory to be used to
+                The "thread-factory" element specifies the bean name of a specific thread factory to be used to
                 create this thread. The optional "exception-handler" element may be used to specify an
                 uncaught exception handler for the thread.  The optional "task-filter" element may be used to
                 specify a filter for the task handed to this thread.
@@ -75,13 +75,12 @@
         </xsd:annotation>
         <xsd:all>
             <xsd:element name="task" type="ref"/>
-            <xsd:element name="thread-factory" type="ref" minOccurs="0"/>
-            <xsd:element name="exception-handler" type="exception-handler" minOccurs="0"/>
+            <xsd:element name="thread-factory" type="ref"/>
+            <xsd:element name="exception-handler" type="ref" minOccurs="0"/>
             <xsd:element name="task-filter" type="task-filter" minOccurs="0"/>
         </xsd:all>
         <xsd:attribute name="name" type="xsd:string" use="required"/>
         <xsd:attribute name="daemon" type="xsd:boolean" use="optional"/>
-        <xsd:attribute name="thread-name-pattern" type="xsd:string" use="optional"/>
         <xsd:attribute name="priority" type="priority" use="optional"/>
     </xsd:complexType>
 
@@ -127,7 +126,7 @@
 
         <xsd:all>
             <xsd:element name="thread-group" type="ref" minOccurs="0"/>
-            <xsd:element name="exception-handler" type="exception-handler" minOccurs="0"/>
+            <xsd:element name="exception-handler" type="ref" minOccurs="0"/>
             <xsd:element name="task-filter" type="task-filter" minOccurs="0"/>
         </xsd:all>
         <xsd:attribute name="name" type="xsd:string" use="required"/>
@@ -139,9 +138,12 @@
     <xsd:complexType name="thread-factory-executor">
         <xsd:annotation>
             <xsd:documentation>
-                An executor which simply executes each task in a new thread.  The "name" attribute is the bean name of
-                the created executor.
+                An executor which simply executes each task in a new thread.
 
+                The "name" attribute is the bean name of the created executor.
+                The "blocking" attribute specifies whether the submitter thread will block if the maximum number of threads
+                are already active.
+
                 The optional "thread-factory" element specifies the bean name of a specific thread factory to
                 use to create worker threads.  The optional "task-filter" element may be used to
                 specify a filter for each executed task.
@@ -150,8 +152,10 @@
         <xsd:all>
             <xsd:element name="thread-factory" type="ref" minOccurs="0"/>
             <xsd:element name="task-filter" type="task-filter" minOccurs="0"/>
+            <xsd:element name="max-threads" type="scaled-count" minOccurs="0"/>
         </xsd:all>
         <xsd:attribute name="name" use="required"/>
+        <xsd:attribute name="blocking" use="optional" type="xsd:boolean"/>
     </xsd:complexType>
 
     <xsd:complexType name="unbounded-queue-thread-pool-executor">
@@ -164,7 +168,7 @@
 
                 The "name" attribute is the bean name of the created executor.
 
-                The nested "core-thread-count" element must be used to specify the core thread pool size.  The nested
+                The nested "core-threads" element must be used to specify the core thread pool size.  The nested
                 "keepalive-time" element may used to specify the amount of time that pool threads should
                 be kept running when idle; if not specified, threads will run until the executor is shut down.
                 The optional "task-filter" element may be used to specify a filter for each executed task. The
@@ -173,7 +177,7 @@
             </xsd:documentation>
         </xsd:annotation>
         <xsd:all>
-            <xsd:element name="core-thread-count" type="scaled-count"/>
+            <xsd:element name="core-threads" type="scaled-count"/>
             <xsd:element name="keepalive-time" type="time" minOccurs="0"/>
             <xsd:element name="task-filter" type="task-filter" minOccurs="0"/>
             <xsd:element name="thread-factory" type="ref" minOccurs="0"/>
@@ -197,8 +201,8 @@
                 The "blocking" attribute specifies whether the submitter thread will block if no space is available in
                 this executor.
 
-                The required "core-thread-count" element specifies the core thread pool size.
-                The optional "max-thread-count" element may be used to specify the maximum thread pool size; if not specified,
+                The required "core-threads" element specifies the core thread pool size.
+                The optional "max-threads" element may be used to specify the maximum thread pool size; if not specified,
                 it will default to be equal to the core pool size.  The required "queue-length" element specifies the
                 queue length.  The nested "keepalive-time" element may used to specify the amount of time that threads
                 beyond the core pool size should be kept running when idle.  The optional "task-filter" element may be
@@ -208,9 +212,9 @@
             </xsd:documentation>
         </xsd:annotation>
         <xsd:all>
-            <xsd:element name="core-thread-count" type="scaled-count"/>
+            <xsd:element name="core-threads" type="scaled-count"/>
             <xsd:element name="queue-length" type="scaled-count"/>
-            <xsd:element name="max-thread-count" type="scaled-count" minOccurs="0"/>
+            <xsd:element name="max-threads" type="scaled-count" minOccurs="0"/>
             <xsd:element name="keepalive-time" type="time" minOccurs="0"/>
             <xsd:element name="task-filter" type="task-filter" minOccurs="0"/>
             <xsd:element name="thread-factory" type="ref" minOccurs="0"/>
@@ -232,7 +236,7 @@
                 The "name" attribute is the bean name of the created executor.  The "blocking" attribute specifies
                 whether the submitter thread will block if no space is available in this executor.
 
-                The "core-thread-count" element specifies the number of threads to use for this executor before
+                The "core-threads" element specifies the number of threads to use for this executor before
                 tasks cannot be accepted anymore.  The optional "keepalive-time" is used to specify the amount of time
                 that threads should be kept running when idle; by default threads run indefinitely.  The optional
                 "task-filter" element may be used to specify a filter for each executed task.  The optional
@@ -242,7 +246,7 @@
             </xsd:documentation>
         </xsd:annotation>
         <xsd:all>
-            <xsd:element name="core-thread-count" type="scaled-count"/>
+            <xsd:element name="core-threads" type="scaled-count"/>
             <xsd:element name="keepalive-time" type="time" minOccurs="0"/>
             <xsd:element name="task-filter" type="task-filter" minOccurs="0"/>
             <xsd:element name="thread-factory" type="ref" minOccurs="0"/>
@@ -257,12 +261,12 @@
             <xsd:documentation>
                 A scheduled thread pool executor.  The "name" attribute is the bean name of the created executor.  The
                 "thread-factory" attribute specifies the bean name of the thread factory to use to create worker
-                threads.  The nested "pool-size" element may be used to specify the thread pool size.  The nested
+                threads.  The nested "core-threads" element may be used to specify the thread pool size.  The nested
                 "keepalive-time" element is used to specify the amount of time that threads should be kept running when idle.
             </xsd:documentation>
         </xsd:annotation>
         <xsd:all>
-            <xsd:element name="core-thread-count" type="scaled-count"/>
+            <xsd:element name="core-threads" type="scaled-count"/>
             <xsd:element name="keepalive-time" type="time" minOccurs="0"/>
             <xsd:element name="task-filter" type="task-filter" minOccurs="0"/>
             <xsd:element name="thread-factory" type="ref" minOccurs="0"/>
@@ -275,18 +279,15 @@
             <xsd:documentation>
                 An executor which runs tasks in order using the given delegate executor.
 
-                The "name" attribute specifies the bean name of the created executor.  The "factory" attribute specifies
-                whether the executor bean should be treated as a factory (that is, every time it is referenced in an
-                injection, a new instance is created) or as a single instance.
+                The "name" attribute specifies the bean name of the created executor.
 
                 The "parent-executor" element specifies the delegate executor which runs the actual tasks.
             </xsd:documentation>
         </xsd:annotation>
         <xsd:all>
-            <xsd:element name="parent-executor" type="ref" minOccurs="1"/>
+            <xsd:element name="parent-executor" type="ref"/>
         </xsd:all>
         <xsd:attribute name="name" use="required" type="xsd:string"/>
-        <xsd:attribute name="factory" use="optional" type="xsd:boolean" default="false"/>
     </xsd:complexType>
 
     <xsd:complexType name="bounded-ordered-executor">
@@ -294,9 +295,7 @@
             <xsd:documentation>
                 An executor which runs tasks in order using the given delegate executor, with a bounded queue size.
 
-                The "name" attribute specifies the bean name of the created executor.  The "factory" attribute specifies
-                whether the executor bean should be treated as a factory (that is, every time it is referenced in an
-                injection, a new instance is created) or as a single instance.  The "blocking" attribute specifies whether
+                The "name" attribute specifies the bean name of the created executor.  The "blocking" attribute specifies whether
                 the submitting task should block rather than hand off or reject the task if the queue is full.
 
                 The "parent-executor" element specifies the delegate executor which runs the actual tasks.  The
@@ -310,7 +309,6 @@
             <xsd:element name="handoff-executor" type="ref" minOccurs="0"/>
         </xsd:all>
         <xsd:attribute name="name" use="required" type="xsd:string"/>
-        <xsd:attribute name="factory" use="optional" type="xsd:boolean" default="false"/>
         <xsd:attribute name="blocking" use="optional" type="xsd:boolean"/>
     </xsd:complexType>
 
@@ -339,8 +337,8 @@
             </xsd:documentation>
         </xsd:annotation>
         <xsd:choice minOccurs="0" maxOccurs="unbounded">
-            <xsd:element name="thread-name" type="xsd:string"/>
-            <xsd:element name="thread-name-notation" type="xsd:string"/>
+            <xsd:element name="thread-name" type="string-value"/>
+            <xsd:element name="thread-name-notation" type="string-value"/>
             <xsd:element name="log-exceptions" type="logger-ref"/>
             <xsd:element name="clear-tls"/>
             <xsd:element name="clear-context-classloader"/>
@@ -371,6 +369,10 @@
         <xsd:attribute name="name" type="xsd:string" use="required"/>
     </xsd:complexType>
 
+    <xsd:complexType name="string-value">
+        <xsd:attribute name="value" type="xsd:string" use="required"/>
+    </xsd:complexType>
+
     <xsd:complexType name="logger-ref">
         <xsd:annotation>
             <xsd:documentation>
@@ -381,16 +383,6 @@
         <xsd:attribute name="level" type="xsd:string" use="optional"/>
     </xsd:complexType>
 
-    <xsd:complexType name="exception-handler">
-        <xsd:annotation>
-            <xsd:documentation>
-                A reference to an exception handler for a thread or executor.  The referenced bean should implement
-                java.lang.Thread.UncaughtExceptionHandler.
-            </xsd:documentation>
-        </xsd:annotation>
-        <xsd:attribute name="name" type="xsd:string" use="required"/>
-    </xsd:complexType>
-
     <xsd:complexType name="interrupt-handler">
         <xsd:attribute name="name" type="xsd:string" use="required"/>
     </xsd:complexType>
@@ -454,4 +446,4 @@
         </xsd:restriction>
     </xsd:simpleType>
 
-</xsd:schema>
\ No newline at end of file
+</xsd:schema>

Modified: projects/jboss-threads/trunk/main/pom.xml
===================================================================
--- projects/jboss-threads/trunk/main/pom.xml	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/main/pom.xml	2010-01-13 19:57:37 UTC (rev 99355)
@@ -7,7 +7,7 @@
     <groupId>org.jboss.threads</groupId>
     <artifactId>jboss-threads</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.0.CR1-SNAPSHOT</version>
+    <version>2.0.0.CR1</version>
     <dependencies>
         <dependency>
             <groupId>org.jboss.logging</groupId>

Modified: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ExceptionLoggingExecutor.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ExceptionLoggingExecutor.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ExceptionLoggingExecutor.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -28,17 +28,23 @@
 
     private final DirectExecutor delegate;
     private final Logger log;
+    private final Logger.Level level;
 
-    ExceptionLoggingExecutor(final DirectExecutor delegate, final Logger log) {
+    ExceptionLoggingExecutor(final DirectExecutor delegate, final Logger log, final Logger.Level level) {
         this.delegate = delegate;
         this.log = log;
+        this.level = level;
     }
 
+    ExceptionLoggingExecutor(final DirectExecutor delegate, final Logger log) {
+        this(delegate, log, Logger.Level.ERROR);
+    }
+
     public void execute(final Runnable command) {
         try {
             delegate.execute(command);
         } catch (Throwable t) {
-            log.error("Exception thrown from thread task", t);
+            log.logf(level, t, "Exception thrown from thread task");
         }
     }
 

Modified: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossExecutors.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossExecutors.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossExecutors.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -224,6 +224,18 @@
     }
 
     /**
+     * Create a direct executor which consumes and logs errors that are thrown.
+     *
+     * @param delegate the executor to delegate to
+     * @param log the logger to which exceptions are written
+     * @param level the level at which to log exceptions
+     * @return the new direct executor
+     */
+    public static DirectExecutor exceptionLoggingExecutor(final DirectExecutor delegate, final Logger log, final Logger.Level level) {
+        return new ExceptionLoggingExecutor(delegate, log, level);
+    }
+
+    /**
      * Create a direct executor which consumes and logs errors that are thrown to the default thread error category
      * {@code "org.jboss.threads.errors"}.
      *
@@ -313,7 +325,7 @@
      * @return the executor
      */
     public static Executor threadFactoryExecutor(final ThreadFactory factory) {
-        return new ThreadFactoryExecutor("unnamed", factory, Integer.MAX_VALUE, false);
+        return new ThreadFactoryExecutor(factory, Integer.MAX_VALUE, false, directExecutor());
     }
 
     /**
@@ -325,7 +337,7 @@
      * @return the executor
      */
     public static Executor threadFactoryExecutor(final ThreadFactory factory, final int maxThreads) {
-        return new ThreadFactoryExecutor("unnamed", factory, maxThreads, false);
+        return new ThreadFactoryExecutor(factory, maxThreads, false, directExecutor());
     }
 
     /**
@@ -339,9 +351,24 @@
      * @return the executor
      */
     public static Executor threadFactoryExecutor(final ThreadFactory factory, final int maxThreads, final boolean blocking) {
-        return new ThreadFactoryExecutor("unnamed", factory, maxThreads, blocking);
+        return new ThreadFactoryExecutor(factory, maxThreads, blocking, directExecutor());
     }
 
+    /**
+     * Create an executor that executes each task in a new thread.  By default up to the given number of threads may run
+     * concurrently, after which the caller will block or new tasks will be rejected, according to the setting of the
+     * {@code blocking} parameter.
+     *
+     * @param factory the thread factory to use
+     * @param maxThreads the maximum number of allowed threads
+     * @param blocking {@code true} if the submitter should block when the maximum number of threads has been reached
+     * @param taskExecutor the executor which should run each task
+     * @return the executor
+     */
+    public static Executor threadFactoryExecutor(final ThreadFactory factory, final int maxThreads, final boolean blocking, final DirectExecutor taskExecutor) {
+        return new ThreadFactoryExecutor(factory, maxThreads, blocking, taskExecutor);
+    }
+
     // ==================================================
     // REJECTED EXECUTION HANDLERS
     // ==================================================

Added: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossScheduledThreadPoolExecutor.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossScheduledThreadPoolExecutor.java	                        (rev 0)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossScheduledThreadPoolExecutor.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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;
+
+import java.util.concurrent.RejectedExecutionHandler;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.jboss.threads.management.ThreadPoolExecutorMBean;
+
+public final class JBossScheduledThreadPoolExecutor extends ScheduledThreadPoolExecutor implements ThreadPoolExecutorMBean {
+
+    private final AtomicInteger rejectCount = new AtomicInteger();
+
+    public JBossScheduledThreadPoolExecutor(int corePoolSize) {
+        super(corePoolSize);
+        setRejectedExecutionHandler(super.getRejectedExecutionHandler());
+    }
+
+    public JBossScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory) {
+        super(corePoolSize, threadFactory);
+        setRejectedExecutionHandler(super.getRejectedExecutionHandler());
+    }
+
+    public JBossScheduledThreadPoolExecutor(int corePoolSize, RejectedExecutionHandler handler) {
+        super(corePoolSize);
+        setRejectedExecutionHandler(handler);
+    }
+
+    public JBossScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
+        super(corePoolSize, threadFactory);
+        setRejectedExecutionHandler(handler);
+    }
+
+    public long getKeepAliveTime() {
+        return getKeepAliveTime(TimeUnit.MILLISECONDS);
+    }
+
+    public void setKeepAliveTime(final long milliseconds) {
+        super.setKeepAliveTime(milliseconds, TimeUnit.MILLISECONDS);
+        super.allowCoreThreadTimeOut(milliseconds < Long.MAX_VALUE);
+    }
+
+    public void setKeepAliveTime(final long time, final TimeUnit unit) {
+        super.setKeepAliveTime(time, unit);
+        super.allowCoreThreadTimeOut(time < Long.MAX_VALUE);
+    }
+
+    public int getRejectedCount() {
+        return rejectCount.get();
+    }
+
+    public int getCurrentThreadCount() {
+        return getActiveCount();
+    }
+
+    public int getLargestThreadCount() {
+        return getLargestPoolSize();
+    }
+
+    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();
+            if (isShutdown()) {
+                throw new StoppedExecutorException();
+            }
+            delegate.rejectedExecution(r, executor);
+        }
+    }
+}

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	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/JBossThreadPoolExecutor.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -28,50 +28,39 @@
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.RejectedExecutionHandler;
 import java.util.concurrent.atomic.AtomicInteger;
-import org.jboss.threads.management.ThreadPoolExecutorMBean;
+import org.jboss.threads.management.BoundedQueueThreadPoolExecutorMBean;
 
 /**
  *
  */
-public final class JBossThreadPoolExecutor extends ThreadPoolExecutor implements ThreadPoolExecutorMBean {
+public final class JBossThreadPoolExecutor extends ThreadPoolExecutor implements BoundedQueueThreadPoolExecutorMBean {
 
-    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) {
+    public JBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
         super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
-        this.name = name;
+        setRejectedExecutionHandler(super.getRejectedExecutionHandler());
     }
 
-    public JBossThreadPoolExecutor(final String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
+    public JBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
         super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
-        this.name = name;
+        setRejectedExecutionHandler(super.getRejectedExecutionHandler());
     }
 
-    public JBossThreadPoolExecutor(final String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
+    public JBossThreadPoolExecutor(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(final String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
+    public JBossThreadPoolExecutor(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() {
-        shutdown();
-    }
-
     public void execute(final Runnable command) {
         super.execute(command);
     }
 
-    public String getName() {
-        return name;
-    }
-
     public int getLargestThreadCount() {
         return super.getLargestPoolSize();
     }
@@ -108,14 +97,6 @@
         return rejectCount.get();
     }
 
-    public RejectedExecutionHandler getRejectedExecutionHandler() {
-        return ((CountingRejectHandler)super.getRejectedExecutionHandler()).getDelegate();
-    }
-
-    public void setRejectedExecutionHandler(final RejectedExecutionHandler handler) {
-        super.setRejectedExecutionHandler(new CountingRejectHandler(handler));
-    }
-
     public boolean isBlocking() {
         return false;
     }
@@ -124,6 +105,14 @@
         throw new UnsupportedOperationException();
     }
 
+    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;
 

Modified: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/OrderedExecutor.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/OrderedExecutor.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/OrderedExecutor.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -82,7 +82,7 @@
     }
 
     /**
-     * Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy
+     * Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy.
      *
      * @param parent the parent executor
      * @param queueLength the fixed length of the queue to use to hold tasks
@@ -114,12 +114,26 @@
     }
 
     /**
+     * Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy.
+     *
+     * @param parent the parent executor
+     * @param queueLength the fixed length of the queue to use to hold tasks
+     * @param blocking {@code true} if rejected tasks should block, {@code false} if rejected tasks should be handed off
+     * @param handoffExecutor the executor to hand tasks to if the queue is full
+     */
+    public OrderedExecutor(final Executor parent, final int queueLength, final boolean blocking, final Executor handoffExecutor) {
+        this(parent, new ArrayQueue<Runnable>(queueLength), blocking, handoffExecutor);
+    }
+
+
+
+    /**
      * Run a task.
      *
      * @param command the task to run.
      */
     public void execute(Runnable command) {
-        final Executor executor;
+        Executor executor;
         OUT: for (;;) {
             lock.lock();
             try {

Modified: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/QueueExecutor.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/QueueExecutor.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/QueueExecutor.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -45,7 +45,6 @@
 public final class QueueExecutor extends AbstractExecutorService implements ExecutorService, BoundedQueueThreadPoolExecutorMBean {
     private static final Logger log = Logger.getLogger("org.jboss.threads.executor");
 
-    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();
@@ -54,6 +53,7 @@
     // signalled when threads terminate
     private final Condition threadExitCondition = lock.newCondition();
     private final ThreadFactory threadFactory;
+    private final DirectExecutor taskExecutor;
 
     // all protected by poolLock...
     private int corePoolSize;
@@ -70,14 +70,12 @@
     private Set<Thread> workers = new HashSet<Thread>();
 
     private boolean stop;
-    private boolean interrupt;
 
     private Queue<Runnable> queue;
 
     /**
      * Create a new instance.
      *
-     * @param name the name of the executor
      * @param corePoolSize the number of threads to create before enqueueing tasks
      * @param maxPoolSize the maximum number of threads to create
      * @param keepAliveTime the amount of time that an idle thread should remain active
@@ -86,9 +84,9 @@
      * @param threadFactory the thread factory to use for new threads
      * @param blocking {@code true} if the executor should block when the queue is full and no threads are available, {@code false} to use the handoff executor
      * @param handoffExecutor the executor which is called when blocking is disabled and a task cannot be accepted, or {@code null} to reject the task
+     * @param taskExecutor the executor to use to execute tasks
      */
-    public QueueExecutor(final String name, final int corePoolSize, final int maxPoolSize, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final Queue<Runnable> queue, final ThreadFactory threadFactory, final boolean blocking, final Executor handoffExecutor) {
-        this.name = name;
+    public QueueExecutor(final int corePoolSize, final int maxPoolSize, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final Queue<Runnable> queue, final ThreadFactory threadFactory, final boolean blocking, final Executor handoffExecutor, final DirectExecutor taskExecutor) {
         if (threadFactory == null) {
             throw new NullPointerException("threadFactory is null");
         }
@@ -106,10 +104,11 @@
             this.keepAliveTime = keepAliveTime;
             this.keepAliveTimeUnit = keepAliveTimeUnit;
             this.corePoolSize = corePoolSize;
-            this.maxPoolSize = maxPoolSize;
+            this.maxPoolSize = maxPoolSize > corePoolSize ? maxPoolSize : corePoolSize;
             this.queue = queue;
             this.blocking = blocking;
             this.handoffExecutor = handoffExecutor;
+            this.taskExecutor = taskExecutor;
         } finally {
             lock.unlock();
         }
@@ -118,42 +117,33 @@
     /**
      * Create a new instance.
      *
-     * @param name the name of the executor
      * @param corePoolSize the number of threads to create before enqueueing tasks
      * @param maxPoolSize the maximum number of threads to create
      * @param keepAliveTime the amount of time that an idle thread should remain active
      * @param keepAliveTimeUnit the unit of time for {@code keepAliveTime}
+     * @param queue the queue to use for tasks
+     * @param threadFactory the thread factory to use for new threads
+     * @param blocking {@code true} if the executor should block when the queue is full and no threads are available, {@code false} to use the handoff executor
+     * @param handoffExecutor the executor which is called when blocking is disabled and a task cannot be accepted, or {@code null} to reject the task
+     */
+    public QueueExecutor(final int corePoolSize, final int maxPoolSize, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final Queue<Runnable> queue, final ThreadFactory threadFactory, final boolean blocking, final Executor handoffExecutor) {
+        this(corePoolSize, maxPoolSize, keepAliveTime, keepAliveTimeUnit, queue, threadFactory, blocking, handoffExecutor, JBossExecutors.directExecutor());
+    }
+
+    /**
+     * Create a new instance.
+     *
+     * @param corePoolSize the number of threads to create before enqueueing tasks
+     * @param maxPoolSize the maximum number of threads to create
+     * @param keepAliveTime the amount of time that an idle thread should remain active
+     * @param keepAliveTimeUnit the unit of time for {@code keepAliveTime}
      * @param queueLength the fixed queue length to use for tasks
      * @param threadFactory the thread factory to use for new threads
      * @param blocking {@code true} if the executor should block when the queue is full and no threads are available, {@code false} to use the handoff executor
      * @param handoffExecutor the executor which is called when blocking is disabled and a task cannot be accepted, or {@code null} to reject the task
      */
-    public QueueExecutor(final String name, final int corePoolSize, final int maxPoolSize, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final int queueLength, final ThreadFactory threadFactory, final boolean blocking, final Executor handoffExecutor) {
-        this.name = name;
-        if (threadFactory == null) {
-            throw new NullPointerException("threadFactory is null");
-        }
-        if (queue == null) {
-            throw new NullPointerException("queue is null");
-        }
-        if (keepAliveTimeUnit == null) {
-            throw new NullPointerException("keepAliveTimeUnit is null");
-        }
-        final Lock lock = this.lock;
-        lock.lock();
-        try {
-            this.threadFactory = threadFactory;
-            // configurable...
-            this.keepAliveTime = keepAliveTime;
-            this.keepAliveTimeUnit = keepAliveTimeUnit;
-            this.corePoolSize = corePoolSize;
-            this.maxPoolSize = maxPoolSize;
-            queue = new ArrayQueue<Runnable>(queueLength);
-            this.blocking = blocking;
-            this.handoffExecutor = handoffExecutor;
-        } finally {
-            lock.unlock();
-        }
+    public QueueExecutor(final int corePoolSize, final int maxPoolSize, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final int queueLength, final ThreadFactory threadFactory, final boolean blocking, final Executor handoffExecutor) {
+        this(corePoolSize, maxPoolSize, keepAliveTime, keepAliveTimeUnit, new ArrayQueue<Runnable>(queueLength), threadFactory, blocking, handoffExecutor);
     }
 
     /**
@@ -585,11 +575,6 @@
     }
 
     /** {@inheritDoc} */
-    public String getName() {
-        return name;
-    }
-
-    /** {@inheritDoc} */
     public int getCurrentThreadCount() {
         final Lock lock = this.lock;
         lock.lock();
@@ -624,7 +609,7 @@
 
     private void runTask(Runnable task) {
         if (task != null) try {
-            task.run();
+            taskExecutor.execute(task);
         } catch (Throwable t) {
             log.errorf(t, "Task execution failed for task %s", task);
         }

Modified: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/QueuelessExecutor.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/QueuelessExecutor.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/QueuelessExecutor.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -45,7 +45,6 @@
 public final class QueuelessExecutor extends AbstractExecutorService implements ExecutorService, BoundedThreadPoolExecutorMBean  {
     private static final Logger log = Logger.getLogger("org.jboss.threads.executor");
 
-    private final String name;
     private final ThreadFactory threadFactory;
     private final DirectExecutor taskExecutor;
 
@@ -97,8 +96,7 @@
     private int largestPoolSize;
     private int rejectedCount;
 
-    public QueuelessExecutor(final String name, final ThreadFactory threadFactory, final DirectExecutor taskExecutor, final Executor handoffExecutor, final long idleTimeout) {
-        this.name = name;
+    public QueuelessExecutor(final ThreadFactory threadFactory, final DirectExecutor taskExecutor, final Executor handoffExecutor, final long idleTimeout) {
         this.threadFactory = threadFactory;
         this.taskExecutor = taskExecutor;
         this.handoffExecutor = handoffExecutor;
@@ -155,10 +153,6 @@
         }
     }
 
-    public String getName() {
-        return name;
-    }
-
     public int getCorePoolSize() {
         final Lock lock = this.lock;
         lock.lock();

Modified: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ThreadFactoryExecutor.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ThreadFactoryExecutor.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/ThreadFactoryExecutor.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -33,8 +33,8 @@
 
     private final ThreadFactory factory;
     private final Semaphore limitSemaphore;
+    private final DirectExecutor taskExecutor;
 
-    private final String name;
     private final Object lock = new Object();
     private int maxThreads;
     private int largestThreadCount;
@@ -42,11 +42,11 @@
     private final AtomicInteger rejected = new AtomicInteger();
     private volatile boolean blocking;
 
-    ThreadFactoryExecutor(final String name, final ThreadFactory factory, int maxThreads, boolean blocking) {
-        this.name = name;
+    ThreadFactoryExecutor(final ThreadFactory factory, int maxThreads, boolean blocking, final DirectExecutor taskExecutor) {
         this.factory = factory;
         this.maxThreads = maxThreads;
         this.blocking = blocking;
+        this.taskExecutor = taskExecutor;
         limitSemaphore = new Semaphore(maxThreads);
     }
 
@@ -100,7 +100,7 @@
                                     largestThreadCount = t;
                                 }
                             }
-                            command.run();
+                            taskExecutor.execute(command);
                             synchronized (lock) {
                                 currentThreadCount--;
                             }
@@ -143,10 +143,6 @@
         }
     }
 
-    public String getName() {
-        return name;
-    }
-
     public int getRejectedCount() {
         return rejected.get();
     }

Modified: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/management/ThreadExecutorMBean.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/management/ThreadExecutorMBean.java	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/management/ThreadExecutorMBean.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -26,7 +26,6 @@
  *
  */
 public interface ThreadExecutorMBean {
-    String getName();
 
     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	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/main/src/test/java/org/jboss/threads/ThreadPoolTestCase.java	2010-01-13 19:57:37 UTC (rev 99355)
@@ -28,7 +28,6 @@
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.LinkedList;
 
 /**
  *
@@ -62,7 +61,7 @@
         final int cnt = 100;
         final CountDownLatch taskUnfreezer = new CountDownLatch(1);
         final CountDownLatch taskFinishLine = new CountDownLatch(cnt);
-        final ExecutorService simpleQueueExecutor = new QueueExecutor("test-pool", 5, 5, 500L, TimeUnit.MILLISECONDS, new LinkedList<Runnable>(), threadFactory, true, null);
+        final ExecutorService simpleQueueExecutor = new QueueExecutor(5, 5, 500L, TimeUnit.MILLISECONDS, 1000, threadFactory, true, null);
         for (int i = 0; i < cnt; i ++) {
             simpleQueueExecutor.execute(new SimpleTask(taskUnfreezer, taskFinishLine));
         }
@@ -77,7 +76,7 @@
             });
             fail("Task not rejected after shutdown");
         } catch (Throwable t) {
-            assertEquals(RejectedExecutionException.class, t.getClass());
+            assertTrue(t instanceof RejectedExecutionException);
         }
         assertTrue(simpleQueueExecutor.awaitTermination(800L, TimeUnit.MILLISECONDS));
     }
@@ -87,7 +86,7 @@
         final AtomicBoolean ran = new AtomicBoolean();
 
         final CountDownLatch startLatch = new CountDownLatch(1);
-        final ExecutorService simpleQueueExecutor = new QueueExecutor("test-pool", 5, 5, 500L, TimeUnit.MILLISECONDS, new LinkedList<Runnable>(), threadFactory, true, null);
+        final ExecutorService simpleQueueExecutor = new QueueExecutor(5, 5, 500L, TimeUnit.MILLISECONDS, 1000, threadFactory, true, null);
         simpleQueueExecutor.execute(new Runnable() {
             public void run() {
                 try {
@@ -121,7 +120,7 @@
         final int cnt = queueSize + coreThreads + extraThreads;
         final CountDownLatch taskUnfreezer = new CountDownLatch(1);
         final CountDownLatch taskFinishLine = new CountDownLatch(cnt);
-        final ExecutorService simpleQueueExecutor = new QueueExecutor("test-pool", coreThreads, coreThreads + extraThreads, 500L, TimeUnit.MILLISECONDS, new ArrayQueue<Runnable>(queueSize), threadFactory, true, null);
+        final ExecutorService simpleQueueExecutor = new QueueExecutor(coreThreads, coreThreads + extraThreads, 500L, TimeUnit.MILLISECONDS, new ArrayQueue<Runnable>(queueSize), threadFactory, true, null);
         for (int i = 0; i < cnt; i ++) {
             simpleQueueExecutor.execute(new SimpleTask(taskUnfreezer, taskFinishLine));
         }

Modified: projects/jboss-threads/trunk/pom.xml
===================================================================
--- projects/jboss-threads/trunk/pom.xml	2010-01-13 18:15:51 UTC (rev 99354)
+++ projects/jboss-threads/trunk/pom.xml	2010-01-13 19:57:37 UTC (rev 99355)
@@ -6,7 +6,7 @@
 
     <groupId>org.jboss.threads</groupId>
     <artifactId>jboss-threads-all</artifactId>
-    <version>1.1.0.CR1-SNAPSHOT</version>
+    <version>2.0.0.CR1</version>
     <packaging>pom</packaging>
     <modules>
         <module>main</module>




More information about the jboss-cvs-commits mailing list