@@ -1627,25 +1627,23 @@ private Message doSendAndReceiveWithDirect(String exchange, String routingKey, M
1627
1627
if (this .usePublisherConnection && connectionFactory .getPublisherConnectionFactory () != null ) {
1628
1628
connectionFactory = connectionFactory .getPublisherConnectionFactory ();
1629
1629
}
1630
- DirectReplyToMessageListenerContainer container = this .directReplyToContainers .get (connectionFactory );
1631
- if (container == null ) {
1632
- synchronized (this .directReplyToContainers ) {
1633
- container = this .directReplyToContainers .get (connectionFactory );
1634
- if (container == null ) {
1635
- container = new DirectReplyToMessageListenerContainer (connectionFactory );
1636
- container .setMessageListener (this );
1637
- container .setBeanName (this .beanName + "#" + this .containerInstance .getAndIncrement ());
1638
- if (this .taskExecutor != null ) {
1639
- container .setTaskExecutor (this .taskExecutor );
1640
- }
1641
- if (this .afterReceivePostProcessors != null ) {
1642
- container .setAfterReceivePostProcessors (this .afterReceivePostProcessors
1643
- .toArray (new MessagePostProcessor [this .afterReceivePostProcessors .size ()]));
1644
- }
1645
- container .start ();
1646
- this .directReplyToContainers .put (connectionFactory , container );
1647
- this .replyAddress = Address .AMQ_RABBITMQ_REPLY_TO ;
1630
+ DirectReplyToMessageListenerContainer container ;
1631
+ synchronized (this .directReplyToContainers ) {
1632
+ container = this .directReplyToContainers .get (connectionFactory );
1633
+ if (container == null ) {
1634
+ container = new DirectReplyToMessageListenerContainer (connectionFactory );
1635
+ container .setMessageListener (this );
1636
+ container .setBeanName (this .beanName + "#" + this .containerInstance .getAndIncrement ());
1637
+ if (this .taskExecutor != null ) {
1638
+ container .setTaskExecutor (this .taskExecutor );
1639
+ }
1640
+ if (this .afterReceivePostProcessors != null ) {
1641
+ container .setAfterReceivePostProcessors (this .afterReceivePostProcessors
1642
+ .toArray (new MessagePostProcessor [this .afterReceivePostProcessors .size ()]));
1648
1643
}
1644
+ container .start ();
1645
+ this .directReplyToContainers .put (connectionFactory , container );
1646
+ this .replyAddress = Address .AMQ_RABBITMQ_REPLY_TO ;
1649
1647
}
1650
1648
}
1651
1649
ChannelHolder channelHolder = container .getChannelHolder ();
0 commit comments