From 1107bfacb4633318be99c91d13ad50766e10f769 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Tue, 10 Nov 2015 09:47:51 -0500 Subject: [PATCH] Fix Stomp Test Race Condition Message producers are started in phase `Integer.MAX_INT / 2`. The test case has a stomp inbound adapter and an event producer. Since they are both in the same phase, the event producer can miss the `StompReceiptEvent`. Change the phase of the event producer to ensure it is started before other message producers. --- .../inbound/ApplicationEventListeningMessageProducer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java b/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java index 29c7ea29c9..25169fea68 100644 --- a/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java +++ b/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java @@ -56,6 +56,10 @@ public class ApplicationEventListeningMessageProducer extends ExpressionMessageP private volatile long stoppedAt; + public ApplicationEventListeningMessageProducer() { + setPhase(Integer.MAX_VALUE / 2 - 1000); + } + /** * Set the list of event types (classes that extend ApplicationEvent) that * this adapter should send to the message channel. By default, all event