INT-3475: Integer.MAX_VALUE / 2 Phase for MDEs

JIRA: https://jira.spring.io/browse/INT-3475

Change the phase for `SourcePollingChannelAdapterFactoryBean`, `AbstractPollingEndpoint`, `MessageProducerSupport`, `JmsMessageDrivenEndpoint`
to the `Integer.MAX_VALUE / 2`
This commit is contained in:
Artem Bilan
2014-07-17 18:13:06 +03:00
committed by Gary Russell
parent 5bb2141fe2
commit 7abefb08df
8 changed files with 50 additions and 37 deletions

View File

@@ -45,7 +45,8 @@ import org.springframework.util.Assert;
* @see ApplicationEventMulticaster
* @see ExpressionMessageProducerSupport
*/
public class ApplicationEventListeningMessageProducer extends ExpressionMessageProducerSupport implements SmartApplicationListener {
public class ApplicationEventListeningMessageProducer extends ExpressionMessageProducerSupport
implements SmartApplicationListener {
private volatile Set<Class<? extends ApplicationEvent>> eventTypes;
@@ -55,8 +56,6 @@ public class ApplicationEventListeningMessageProducer extends ExpressionMessageP
private volatile long stoppedAt;
private volatile boolean phaseSet;
/**
* Set the list of event types (classes that extend ApplicationEvent) that
* this adapter should send to the message channel. By default, all event
@@ -81,12 +80,6 @@ public class ApplicationEventListeningMessageProducer extends ExpressionMessageP
}
}
@Override
public void setPhase(int phase) {
super.setPhase(phase);
this.phaseSet = true;
}
@Override
public String getComponentType() {
return "event:inbound-channel-adapter";
@@ -96,12 +89,11 @@ public class ApplicationEventListeningMessageProducer extends ExpressionMessageP
protected void onInit() {
super.onInit();
this.applicationEventMulticaster = this.getBeanFactory()
.getBean(AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME, ApplicationEventMulticaster.class);
.getBean(AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME,
ApplicationEventMulticaster.class);
Assert.notNull(this.applicationEventMulticaster,
"To use ApplicationListeners the 'applicationEventMulticaster' bean must be supplied within ApplicationContext.");
if (!this.phaseSet) {
super.setPhase(Integer.MIN_VALUE + 1000);
}
"To use ApplicationListeners the 'applicationEventMulticaster' " +
"bean must be supplied within ApplicationContext.");
}
@Override