This commit is contained in:
Mark Fisher
2008-11-19 17:37:39 +00:00
parent 3d13f7e954
commit 7badd53b9f
2 changed files with 13 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.util.StringUtils;
/**
* @author Mark Fisher
@@ -55,7 +56,10 @@ public class ThreadPoolTaskExecutorParser extends AbstractSimpleBeanDefinitionPa
String policyName = element.getAttribute(REJECTION_POLICY_ATTRIBUTE);
builder.addPropertyValue("rejectedExecutionHandler", createRejectedExecutionHandler(policyName));
builder.addPropertyValue("corePoolSize", element.getAttribute(CORE_SIZE_ATTRIBUTE));
builder.addPropertyValue("maxPoolSize", element.getAttribute(MAX_SIZE_ATTRIBUTE));
String maxSize = element.getAttribute(MAX_SIZE_ATTRIBUTE);
if (StringUtils.hasText(maxSize)) {
builder.addPropertyValue("maxPoolSize", maxSize);
}
}
private RejectedExecutionHandler createRejectedExecutionHandler(String policyName) {

View File

@@ -345,7 +345,14 @@
</xsd:annotation>
<xsd:attribute name="id" type="xsd:ID" use="required"/>
<xsd:attribute name="core-size" type="xsd:string" default="1"/>
<xsd:attribute name="max-size" type="xsd:string" default="10"/>
<xsd:attribute name="max-size" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Specifies the maximum pool size in order to limit the number of concurrent tasks.
Otherwise, the default will be Integer.MAX_VALUE.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="queue-capacity" type="xsd:string" default="0"/>
<xsd:attribute name="keep-alive-seconds" type="xsd:string" default="60"/>
<xsd:attribute name="rejection-policy" default="CALLER_RUNS">