SPR-6460 Added "phase" attribute to the JMS namespace's "jca-listener-container" element.

This commit is contained in:
Mark Fisher 2009-11-27 18:16:08 +00:00
parent dc24944cd9
commit 1ac7b95c1d
6 changed files with 22 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -83,6 +83,8 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
protected static final String CONCURRENCY_ATTRIBUTE = "concurrency";
protected static final String PHASE_ATTRIBUTE = "phase";
protected static final String PREFETCH_ATTRIBUTE = "prefetch";

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -93,6 +93,11 @@ class JcaListenerContainerParser extends AbstractListenerContainerParser {
configDef.getPropertyValues().add("maxConcurrency", concurrency[1]);
}
String phase = containerEle.getAttribute(PHASE_ATTRIBUTE);
if (StringUtils.hasText(phase)) {
containerDef.getPropertyValues().add("phase", phase);
}
String prefetch = containerEle.getAttribute(PREFETCH_ATTRIBUTE);
if (StringUtils.hasText(prefetch)) {
configDef.getPropertyValues().add("prefetchSize", new Integer(prefetch));

View File

@ -44,8 +44,6 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
private static final String ERROR_HANDLER_ATTRIBUTE = "error-handler";
private static final String PHASE_ATTRIBUTE = "phase";
private static final String CACHE_ATTRIBUTE = "cache";

View File

@ -391,6 +391,16 @@
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="phase" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
The lifecycle phase within which this container should start and stop. The lower
the value the earlier this container will start and the later it will stop. The
default is Integer.MAX_VALUE meaning the container will start as late as possible
and stop as soon as possible.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>

View File

@ -153,8 +153,8 @@ public class JmsNamespaceHandlerTests extends TestCase {
int defaultPhase = getPhase(DefaultMessageListenerContainer.class.getName() + "#0");
assertEquals(99, phase1);
assertEquals(99, phase2);
assertEquals(Integer.MAX_VALUE, phase3);
assertEquals(Integer.MAX_VALUE, phase4);
assertEquals(77, phase3);
assertEquals(77, phase4);
assertEquals(Integer.MAX_VALUE, defaultPhase);
}

View File

@ -18,7 +18,7 @@
</jms:listener-container>
<jms:jca-listener-container resource-adapter="testResourceAdapter" activation-spec-factory="testActivationSpecFactory"
message-converter="testMessageConverter">
message-converter="testMessageConverter" phase="77">
<jms:listener id="listener3" destination="testDestination" ref="testBean1" method="setName"/>
<jms:listener id="listener4" destination="testDestination" ref="testBean2" method="setName" response-destination="responseDestination"/>
</jms:jca-listener-container>