[jboss-cvs] JBossAS SVN: r103295 - in projects/profileservice/trunk/domain/src: main/java/org/jboss/profileservice/domain/spi and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 31 04:08:38 EDT 2010
Author: scott.stark at jboss.org
Date: 2010-03-31 04:08:37 -0400 (Wed, 31 Mar 2010)
New Revision: 103295
Added:
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/PropertiesMetaData.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/RefMetaData.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ExecutorMetaData.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadFactoryMetaData.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadGroupMetaData.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadMetaData.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadsMetaData.java
Modified:
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/AbstractDomainMetaData.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaData.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/BasicThreadPoolMetaData.java
projects/profileservice/trunk/domain/src/test/java/org/jboss/test/profileservice/domain/parsing/test/DomainUnitTestCase.java
projects/profileservice/trunk/domain/src/test/resources/parsing/domain.xml
Log:
Add a threads metadata section
Modified: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/AbstractDomainMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/AbstractDomainMetaData.java 2010-03-31 07:29:31 UTC (rev 103294)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/AbstractDomainMetaData.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -37,6 +37,7 @@
import org.jboss.profileservice.domain.spi.DomainMetaData;
import org.jboss.profileservice.domain.threadpool.BasicThreadPoolMetaData;
import org.jboss.profileservice.domain.threadpool.IThreadPool;
+import org.jboss.profileservice.domain.threadpool.ThreadsMetaData;
import org.jboss.xb.annotations.JBossXmlNsPrefix;
import org.jboss.xb.annotations.JBossXmlSchema;
@@ -51,9 +52,9 @@
normalizeSpace=true,
replacePropertyRefs=true,
xmlns={@XmlNs(namespaceURI=DomainMetaData.SERVER_NAMESPACE, prefix="server"),
- @XmlNs(namespaceURI=DomainMetaData.THREAD_POOL_NAMESPACE, prefix="tp")})
+ @XmlNs(namespaceURI=DomainMetaData.THREADS_NAMESPACE, prefix="tp")})
@XmlRootElement(name = "domain")
- at XmlType(name = "domainType", propOrder = {"server", "jdbcResources", "threadPools", "features"})
+ at XmlType(name = "domainType", propOrder = {"server", "jdbcResources", "threads", "features"})
public class AbstractDomainMetaData implements DomainMetaData
{
@@ -64,7 +65,7 @@
private ServerMetaData server;
/** The thread pools of the domain. */
- private List<IThreadPool> threadPools;
+ private ThreadsMetaData threadPools;
private List<JdbcResource> jdbcResources;
/** The elements of the domain. */
@@ -113,14 +114,13 @@
this.jdbcResources = jdbcResources;
}
- @XmlElementWrapper(name="thread-pools", namespace=DomainMetaData.THREAD_POOL_NAMESPACE)
+ @XmlElement(name="threads", namespace=DomainMetaData.THREADS_NAMESPACE)
@JBossXmlNsPrefix(prefix="tp")
- @XmlElement(name="thread-pool", type=BasicThreadPoolMetaData.class)
- public List<IThreadPool> getThreadPools()
+ public ThreadsMetaData getThreads()
{
return threadPools;
}
- public void setThreadPools(List<IThreadPool> threadPools)
+ public void setThreads(ThreadsMetaData threadPools)
{
this.threadPools = threadPools;
}
Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/PropertiesMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/PropertiesMetaData.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/PropertiesMetaData.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.domain;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlMapEntry;
+import org.jboss.xb.annotations.JBossXmlMapKeyAttribute;
+import org.jboss.xb.annotations.JBossXmlMapValueAttribute;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at XmlType(name="mapType", propOrder={})
+ at JBossXmlMapEntry(name="entry")
+ at JBossXmlMapKeyAttribute(name="key")
+ at JBossXmlMapValueAttribute(name="value")
+public class PropertiesMetaData implements Serializable,
+ Map<String, String>
+{
+ private static final long serialVersionUID = 2L;
+
+ /** The map */
+ private HashMap<String, String> props = new HashMap<String, String>();
+ /** The key type */
+ protected String keyType;
+
+ /** The value type */
+ protected String valueType;
+
+ /**
+ * Get the key type
+ *
+ * @return the key type
+ */
+ public String getKeyType()
+ {
+ return keyType;
+ }
+
+ /**
+ * Set the key type
+ *
+ * @param keyType the key type
+ */
+ @XmlAttribute(name="keyClass")
+ public void setKeyType(String keyType)
+ {
+ this.keyType = keyType;
+ }
+
+ /**
+ * Get the value type
+ *
+ * @return the value type
+ */
+ public String getValueType()
+ {
+ return valueType;
+ }
+
+ /**
+ * Set the value type
+ *
+ * @param valueType the value type
+ */
+ @XmlAttribute(name="valueClass")
+ public void setValueType(String valueType)
+ {
+ this.valueType = valueType;
+ }
+
+ @Override
+ public void clear()
+ {
+ props.clear();
+ }
+
+ @Override
+ public boolean containsKey(Object key)
+ {
+ return props.containsKey(key);
+ }
+
+ @Override
+ public boolean containsValue(Object value)
+ {
+ return props.containsValue(value);
+ }
+
+ @Override
+ public Set<java.util.Map.Entry<String, String>> entrySet()
+ {
+ return props.entrySet();
+ }
+
+ @Override
+ public String get(Object key)
+ {
+ return props.get(key);
+ }
+
+ @Override
+ public boolean isEmpty()
+ {
+ return props.isEmpty();
+ }
+
+ @Override
+ public Set<String> keySet()
+ {
+ return props.keySet();
+ }
+
+ @Override
+ public String put(String key, String value)
+ {
+ return props.put(key, value);
+ }
+
+ @Override
+ public void putAll(Map<? extends String, ? extends String> t)
+ {
+ props.putAll(t);
+ }
+
+ @Override
+ public String remove(Object key)
+ {
+ return props.remove(key);
+ }
+
+ @Override
+ public int size()
+ {
+ return props.size();
+ }
+
+ @Override
+ public Collection<String> values()
+ {
+ return props.values();
+ }
+}
Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/RefMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/RefMetaData.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/RefMetaData.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -0,0 +1,44 @@
+/*
+ * 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.profileservice.domain;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * A reference metadata class used by metdata that
+ */
+ at XmlType(name = "refType", propOrder = {})
+public class RefMetaData
+{
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ @XmlAttribute(required = true)
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
+
Modified: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaData.java 2010-03-31 07:29:31 UTC (rev 103294)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaData.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -37,7 +37,7 @@
/** The server xml namespace. */
String SERVER_NAMESPACE = "urn:jboss:profileservice:server:1.0";
/** The thread-pool xml namespace. */
- String THREAD_POOL_NAMESPACE = "urn:jboss:profileservice:thread-pool:1.0";
+ String THREADS_NAMESPACE = "urn:jboss:profileservice:threads:1.0";
/**
* Get the domain features.
Modified: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/BasicThreadPoolMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/BasicThreadPoolMetaData.java 2010-03-31 07:29:31 UTC (rev 103294)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/BasicThreadPoolMetaData.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -13,7 +13,7 @@
import org.jboss.profileservice.domain.spi.DomainMetaData;
import org.jboss.xb.annotations.JBossXmlSchema;
- at JBossXmlSchema(namespace=DomainMetaData.THREAD_POOL_NAMESPACE,
+ at JBossXmlSchema(namespace=DomainMetaData.THREADS_NAMESPACE,
elementFormDefault=XmlNsForm.QUALIFIED,
normalizeSpace=true,
replacePropertyRefs=true)
Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ExecutorMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ExecutorMetaData.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ExecutorMetaData.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -0,0 +1,80 @@
+/*
+ * 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.profileservice.domain.threadpool;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.domain.PropertiesMetaData;
+import org.jboss.xb.annotations.JBossXmlMapKeyElement;
+import org.jboss.xb.annotations.JBossXmlMapValueElement;
+
+import java.util.Map;
+
+ at XmlType(name="mapType", propOrder={})
+public class ExecutorMetaData
+{
+ private String name;
+ private String type;
+ private String executorClass;
+ private PropertiesMetaData executorProperties;
+
+ @XmlAttribute(name="name")
+ public String getName()
+ {
+ return name;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @XmlAttribute(name="type")
+ public String getType()
+ {
+ return type;
+ }
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ @XmlAttribute(name="class")
+ public String getExecutorClass()
+ {
+ return executorClass;
+ }
+ public void setExecutorClass(String executorClass)
+ {
+ this.executorClass = executorClass;
+ }
+
+ public PropertiesMetaData getExecutorProperties()
+ {
+ return executorProperties;
+ }
+
+ public void setExecutorProperties(PropertiesMetaData executorProperties)
+ {
+ this.executorProperties = executorProperties;
+ }
+}
Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadFactoryMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadFactoryMetaData.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadFactoryMetaData.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -0,0 +1,98 @@
+/*
+ * 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.profileservice.domain.threadpool;
+
+import org.jboss.profileservice.domain.RefMetaData;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ */
+ at XmlType(name = "thread-factory", propOrder = {})
+public final class ThreadFactoryMetaData {
+ private String name;
+ private Boolean daemon;
+ private String threadNamePattern = "pool-%f-thread-%t";
+ private Integer priority;
+
+ private RefMetaData threadGroup;
+ private RefMetaData exceptionHandler;
+ // TODO: private TaskFilterMetaData taskFilter;
+
+ public String getName() {
+ return name;
+ }
+
+ @XmlAttribute(required = true)
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public Boolean getDaemon() {
+ return daemon;
+ }
+
+ @XmlAttribute
+ public void setDaemon(final Boolean daemon) {
+ this.daemon = daemon;
+ }
+
+ public String getThreadNamePattern() {
+ return threadNamePattern;
+ }
+
+ @XmlAttribute(name = "thread-name-pattern")
+ public void setThreadNamePattern(final String threadNamePattern) {
+ this.threadNamePattern = threadNamePattern;
+ }
+
+ public Integer getPriority() {
+ return priority;
+ }
+
+ @XmlAttribute
+ public void setPriority(final Integer priority) {
+ this.priority = priority;
+ }
+
+ public RefMetaData getThreadGroup() {
+ return threadGroup;
+ }
+
+ @XmlElement(name = "thread-group")
+ public void setThreadGroup(final RefMetaData threadGroup) {
+ this.threadGroup = threadGroup;
+ }
+
+ public RefMetaData getExceptionHandler() {
+ return exceptionHandler;
+ }
+
+ @XmlElement(name = "exception-handler")
+ public void setExceptionHandler(final RefMetaData exceptionHandler) {
+ this.exceptionHandler = exceptionHandler;
+ }
+
+}
Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadGroupMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadGroupMetaData.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadGroupMetaData.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -0,0 +1,82 @@
+/*
+ * 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.profileservice.domain.threadpool;
+
+import org.jboss.profileservice.domain.RefMetaData;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+ at XmlType(name = "thread-group", propOrder = {})
+public final class ThreadGroupMetaData {
+ private String name;
+ private String groupName;
+ private RefMetaData parentThreadGroup;
+ private Boolean daemon;
+ private Integer maxPriority;
+
+ public String getName() {
+ return name;
+ }
+
+ @XmlAttribute(required = true)
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ @XmlAttribute(name = "group-name")
+ public void setGroupName(final String groupName) {
+ this.groupName = groupName;
+ }
+
+ public RefMetaData getParentThreadGroup() {
+ return parentThreadGroup;
+ }
+
+ @XmlElement(name = "parent-thread-group")
+ public void setParentThreadGroup(final RefMetaData parentThreadGroup) {
+ this.parentThreadGroup = parentThreadGroup;
+ }
+
+ public Boolean isDaemon() {
+ return daemon;
+ }
+
+ @XmlAttribute
+ public void setDaemon(final Boolean daemon) {
+ this.daemon = daemon;
+ }
+
+ public Integer getMaxPriority() {
+ return maxPriority;
+ }
+
+ @XmlAttribute(name = "max-priority")
+ public void setMaxPriority(final Integer maxPriority) {
+ this.maxPriority = maxPriority;
+ }
+}
Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadMetaData.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadMetaData.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -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.profileservice.domain.threadpool;
+
+import org.jboss.profileservice.domain.RefMetaData;
+
+import javax.xml.bind.annotation.XmlType;
+
+
+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;
+ // TODO: 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;
+ }
+
+}
+
Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadsMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadsMetaData.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/threadpool/ThreadsMetaData.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -0,0 +1,102 @@
+/*
+ * 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.profileservice.domain.threadpool;
+
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.jboss.profileservice.domain.spi.DomainMetaData;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ */
+ at JBossXmlSchema(namespace= DomainMetaData.THREADS_NAMESPACE,
+ elementFormDefault=XmlNsForm.QUALIFIED,
+ normalizeSpace=true,
+ replacePropertyRefs=true)
+ at XmlRootElement(name = "threads")
+ at XmlType(name = "threads", propOrder = {})
+public final class ThreadsMetaData
+{
+ private List<ThreadMetaData> threads = new ArrayList<ThreadMetaData>();
+ private List<ThreadGroupMetaData> threadGroups = new ArrayList<ThreadGroupMetaData>();
+ private List<ExecutorMetaData> executors;
+
+ private List<ThreadFactoryMetaData> threadFactories;
+ // TODO: 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 List<ThreadMetaData> getThreads() {
+ return threads;
+ }
+
+ @XmlElement(name = "thread")
+ public void setThreads(final List<ThreadMetaData> threads) {
+ this.threads = threads;
+ }
+
+ public List<ThreadGroupMetaData> getThreadGroups() {
+ return threadGroups;
+ }
+
+ @XmlElement(name = "executor")
+ public List<ExecutorMetaData> getExecutors()
+ {
+ return executors;
+ }
+ public void setExecutors(List<ExecutorMetaData> executors)
+ {
+ this.executors = executors;
+ }
+
+ @XmlElement(name = "thread-group")
+ public void setThreadGroups(final List<ThreadGroupMetaData> threadGroups) {
+ this.threadGroups = threadGroups;
+ }
+
+ public List<ThreadFactoryMetaData> getThreadFactories() {
+ return threadFactories;
+ }
+
+ @XmlElement(name = "thread-factory")
+ public void setThreadFactories(final List<ThreadFactoryMetaData> threadFactories) {
+ this.threadFactories = threadFactories;
+ }
+
+}
+
Modified: projects/profileservice/trunk/domain/src/test/java/org/jboss/test/profileservice/domain/parsing/test/DomainUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/domain/src/test/java/org/jboss/test/profileservice/domain/parsing/test/DomainUnitTestCase.java 2010-03-31 07:29:31 UTC (rev 103294)
+++ projects/profileservice/trunk/domain/src/test/java/org/jboss/test/profileservice/domain/parsing/test/DomainUnitTestCase.java 2010-03-31 08:08:37 UTC (rev 103295)
@@ -1,11 +1,21 @@
package org.jboss.test.profileservice.domain.parsing.test;
import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Properties;
import org.jboss.profileservice.domain.AbstractDomainMetaData;
+import org.jboss.profileservice.domain.PropertiesMetaData;
+import org.jboss.profileservice.domain.RefMetaData;
import org.jboss.profileservice.domain.ServerMetaData;
import org.jboss.profileservice.domain.spi.DomainMetaData;
import org.jboss.profileservice.domain.threadpool.BasicThreadPoolMetaData;
+import org.jboss.profileservice.domain.threadpool.ExecutorMetaData;
+import org.jboss.profileservice.domain.threadpool.ThreadFactoryMetaData;
+import org.jboss.profileservice.domain.threadpool.ThreadGroupMetaData;
+import org.jboss.profileservice.domain.threadpool.ThreadMetaData;
+import org.jboss.profileservice.domain.threadpool.ThreadsMetaData;
import org.jboss.test.BaseTestCase;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -22,7 +32,7 @@
addSchemaBinding(DomainMetaData.DOMAIN_NAMESPACE, AbstractDomainMetaData.class);
// initialize the schema binding
addSchemaBinding(DomainMetaData.SERVER_NAMESPACE, ServerMetaData.class);
- addSchemaBinding(DomainMetaData.THREAD_POOL_NAMESPACE, BasicThreadPoolMetaData.class);
+ addSchemaBinding(DomainMetaData.THREADS_NAMESPACE, BasicThreadPoolMetaData.class);
}
protected static void addSchemaBinding(String nsUri, Class<?> clazz)
{
@@ -46,5 +56,93 @@
Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
Object md = unmarshaller.unmarshal(domain.openStream(), resolver);
DomainMetaData domainMD = DomainMetaData.class.cast(md);
+ assertTrue("domainMD is AbstractDomainMetaData",
+ domainMD instanceof AbstractDomainMetaData);
+ AbstractDomainMetaData amd = (AbstractDomainMetaData) domainMD;
+ ThreadsMetaData threadsMD = amd.getThreads();
+
+ // thread
+ List<ThreadMetaData> threads = threadsMD.getThreads();
+
+ // thread-groups
+ List<ThreadGroupMetaData> threadGroups = threadsMD.getThreadGroups();
+
+ // thread-factorys
+ List<ThreadFactoryMetaData> threadFactorys = threadsMD.getThreadFactories();
+ HashMap<String, ThreadFactoryMetaData> tfmdMap = new HashMap<String, ThreadFactoryMetaData>();
+ for(ThreadFactoryMetaData tfmd : threadFactorys)
+ tfmdMap.put(tfmd.getName(), tfmd);
+ ThreadFactoryMetaData ShortTasksThreadFactory = tfmdMap.get("ShortTasksThreadFactory");
+ assertNotNull("ShortTasksThreadFactory", ShortTasksThreadFactory);
+ RefMetaData tgName = ShortTasksThreadFactory.getThreadGroup();
+ assertEquals("ShortTasksThreadGroup", tgName.getName());
+ ThreadFactoryMetaData LongTasksThreadFactory = tfmdMap.get("LongTasksThreadFactory");
+ assertNotNull("LongTasksThreadFactory", LongTasksThreadFactory);
+ tgName = LongTasksThreadFactory.getThreadGroup();
+ assertEquals("LongTasksThreadGroup", tgName.getName());
+
+ // executors
+ List<ExecutorMetaData> executors = threadsMD.getExecutors();
+ assertEquals("3 executors", 3, executors.size());
+ HashMap<String, ExecutorMetaData> exs = new HashMap<String, ExecutorMetaData>();
+ for(ExecutorMetaData e : executors)
+ exs.put(e.getName(), e);
+ // DirectExecutor
+ ExecutorMetaData DirectExecutor = exs.get("DirectExecutor");
+ assertNotNull("DirectExecutor", DirectExecutor);
+ String dType = DirectExecutor.getType();
+ assertEquals("direct", dType);
+
+ // BoundedThreadPool
+ ExecutorMetaData BoundedThreadPool = exs.get("BoundedThreadPool");
+ assertNotNull("BoundedThreadPool", BoundedThreadPool);
+ String btpType = BoundedThreadPool.getType();
+ assertEquals("bounded-queue-thread-pool", btpType);
+ PropertiesMetaData btpPMD = BoundedThreadPool.getExecutorProperties();
+ /*
+ <entry key="blocking" value="true" />
+ <entry key="thread-factory" value="ShortTasksThreadFactory"/>
+ <entry key="queue-length.count" value="500"/>
+ <entry key="queue-length.per-cpu" value="200"/>
+ <entry key="core-threads.count" value="5"/>
+ <entry key="core-threads.per-cpu" value="2"/>
+ <entry key="max-threads.count" value="10"/>
+ <entry key="max-threads.per-cpu" value="3"/>
+ <entry key="keepalive.time" value="30"/>
+ <entry key="keepalive.time-unit" value="seconds"/>
+ */
+ Properties expectedProps = new Properties();
+ expectedProps.put("blocking", "true");
+ expectedProps.put("thread-factory", "ShortTasksThreadFactory");
+ expectedProps.put("queue-length.count", "500");
+ expectedProps.put("queue-length.per-cpu", "200");
+ expectedProps.put("core-threads.count", "5");
+ expectedProps.put("core-threads.per-cpu", "2");
+ expectedProps.put("max-threads.count", "10");
+ expectedProps.put("max-threads.per-cpu", "3");
+ expectedProps.put("keepalive.time", "30");
+ expectedProps.put("keepalive.time-unit", "seconds");
+ for(Object key : expectedProps.keySet())
+ {
+ String value = btpPMD.get(key);
+ String exValue = expectedProps.getProperty(key.toString());
+ assertEquals(key.toString(), exValue, value);
+ }
+ // LongRunningTasksThreadPool
+ ExecutorMetaData LongRunningTasksThreadPool = exs.get("LongRunningTasksThreadPool");
+ assertNotNull("LongRunningTasksThreadPool", LongRunningTasksThreadPool);
+ String lrtType = LongRunningTasksThreadPool.getType();
+ assertEquals("queueless-thread-pool", lrtType);
+ PropertiesMetaData lrtPMD = LongRunningTasksThreadPool.getExecutorProperties();
+ expectedProps.clear();
+ expectedProps.put("blocking", "true");
+ expectedProps.put("thread-factory", "LongTasksThreadFactory");
+ for(Object key : expectedProps.keySet())
+ {
+ String value = lrtPMD.get(key);
+ String exValue = expectedProps.getProperty(key.toString());
+ assertEquals(key.toString(), exValue, value);
+ }
+
}
}
Modified: projects/profileservice/trunk/domain/src/test/resources/parsing/domain.xml
===================================================================
--- projects/profileservice/trunk/domain/src/test/resources/parsing/domain.xml 2010-03-31 07:29:31 UTC (rev 103294)
+++ projects/profileservice/trunk/domain/src/test/resources/parsing/domain.xml 2010-03-31 08:08:37 UTC (rev 103295)
@@ -19,10 +19,68 @@
<jdbc-resource jndi-name="jdbc/TimerPool" pool-name="TimerPool" enabled="true"/>
</jdbc-resources>
- <thread-pools xmlns="urn:jboss:profileservice:thread-pool:1.0">
- <thread-pool name="JBossDefaultThreadPool" />
- </thread-pools>
+ <threads xmlns="urn:jboss:profileservice:threads:1.0">
+ <!-- The system thread group for all JBoss threads. -->
+ <thread-group name="SystemThreadGroup" group-name="System Threads" daemon="true"/>
+ <!--
+ ~ This thread pool is for SHORT-RUNNING tasks that block very little or not at all. Long-running
+ ~ tasks submitted to this pool may cause starvation and extended blocking.
+ -->
+ <thread-group name="ShortTasksThreadGroup" group-name="Short Tasks Threads">
+ <parent-thread-group name="SystemThreadGroup"/>
+ </thread-group>
+ <!--
+ ~ This thread pool is for LONG-RUNNING tasks that may block for extended periods, such as
+ ~ blocking I/O network connection threads. Short-running tasks submitted to this pool may
+ ~ cause excessive lock contention and performance degradation.
+ -->
+ <thread-group name="LongTasksThreadGroup" group-name="Long Tasks Threads">
+ <parent-thread-group name="SystemThreadGroup"/>
+ </thread-group>
+
+ <!-- A simple direct executor which is always available for use. -->
+ <executor name="DirectExecutor" type="direct">
+
+ </executor>
+ <executor name="BoundedThreadPool" type="bounded-queue-thread-pool">
+ <entry key="blocking" value="true" />
+ <entry key="thread-factory" value="ShortTasksThreadFactory"/>
+ <entry key="queue-length.count" value="500"/>
+ <entry key="queue-length.per-cpu" value="200"/>
+ <entry key="core-threads.count" value="5"/>
+ <entry key="core-threads.per-cpu" value="2"/>
+ <entry key="max-threads.count" value="10"/>
+ <entry key="max-threads.per-cpu" value="3"/>
+ <entry key="keepalive.time" value="30"/>
+ <entry key="keepalive.time-unit" value="seconds"/>
+ <!--
+ <task-filter>
+ <clear-context-classloader/>
+ <clear-tls/>
+ </task-filter>
+ -->
+ </executor>
+ <executor name="LongRunningTasksThreadPool" type="queueless-thread-pool">
+ <entry key="blocking" value="true" />
+ <entry key="thread-factory" value="LongTasksThreadFactory"/>
+ <!--
+ <task-filter>
+ <clear-context-classloader/>
+ <clear-tls/>
+ </task-filter>
+ -->
+ </executor>
+
+ <thread-factory name="ShortTasksThreadFactory">
+ <thread-group name="ShortTasksThreadGroup"/>
+ </thread-factory>
+ <thread-factory name="LongTasksThreadFactory">
+ <thread-group name="LongTasksThreadGroup"/>
+ </thread-factory>
+
+ </threads>
+
<!-- xi:include href="resources.xml"/ -->
<!--
More information about the jboss-cvs-commits
mailing list