Browse Source

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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2536 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Mark Fisher 16 years ago
parent
commit
d2a6399ea5
  1. 4
      org.springframework.jms/src/main/java/org/springframework/jms/config/AbstractListenerContainerParser.java
  2. 7
      org.springframework.jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java
  3. 2
      org.springframework.jms/src/main/java/org/springframework/jms/config/JmsListenerContainerParser.java
  4. 10
      org.springframework.jms/src/main/resources/org/springframework/jms/config/spring-jms-3.0.xsd
  5. 4
      org.springframework.jms/src/test/java/org/springframework/jms/config/JmsNamespaceHandlerTests.java
  6. 2
      org.springframework.jms/src/test/java/org/springframework/jms/config/jmsNamespaceHandlerTests.xml

4
org.springframework.jms/src/main/java/org/springframework/jms/config/AbstractListenerContainerParser.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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";

7
org.springframework.jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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));

2
org.springframework.jms/src/main/java/org/springframework/jms/config/JmsListenerContainerParser.java

@ -44,8 +44,6 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser { @@ -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";

10
org.springframework.jms/src/main/resources/org/springframework/jms/config/spring-jms-3.0.xsd

@ -391,6 +391,16 @@ @@ -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>

4
org.springframework.jms/src/test/java/org/springframework/jms/config/JmsNamespaceHandlerTests.java

@ -153,8 +153,8 @@ public class JmsNamespaceHandlerTests extends TestCase { @@ -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);
}

2
org.springframework.jms/src/test/java/org/springframework/jms/config/jmsNamespaceHandlerTests.xml

@ -18,7 +18,7 @@ @@ -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>

Loading…
Cancel
Save