Source:
<code>private Message doSendAndReceiveWithDirect(String exchange, String routingKey, Message message, CorrelationData correlationData) { ConnectionFactory connectionFactory = obtainTargetConnectionFactory( this.sendConnectionFactorySelectorExpression, message); if (this.usePublisherConnection && connectionFactory.getPublisherConnectionFactory() != null) { connectionFactory = connectionFactory.getPublisherConnectionFactory(); } <START> DirectReplyToMessageListenerContainer container; <END> synchronized (this.directReplyToContainers) { container = this.directReplyToContainers.get(connectionFactory); if (container == null) { container = new DirectReplyToMessageListenerContainer(connectionFactory); container.setMessageListener(this); container.setBeanName(this.beanName + "#" + this.containerInstance.getAndIncrement()); if (this.taskExecutor != null) { container.setTaskExecutor(this.taskExecutor); } if (this.afterReceivePostProcessors != null) { container.setAfterReceivePostProcessors(this.afterReceivePostProcessors .toArray(new MessagePostProcessor[this.afterReceivePostProcessors.size()])); } container.start(); this.directReplyToContainers.put(connectionFactory, container); this.replyAddress = Address.AMQ_RABBITMQ_REPLY_TO; } } ChannelHolder channelHolder = container.getChannelHolder(); try { return doSendAndReceiveAsListener(exchange, routingKey, message, correlationData, channelHolder.getChannel()); } catch (Exception e) { container.releaseConsumerFor(channelHolder, false, null); throw RabbitExceptionTranslator.convertRabbitAccessException(e); } }</code><technical_language>Yeah... good point. again: for consistency approach. in case stale value, override it. do is cleaning map stop(). sense "unsafe" get() ? Thanks</technical_language>

Target:
private Message doSendAndReceiveWithDirect(String exchange, String routingKey, Message message, CorrelationData correlationData) { ConnectionFactory connectionFactory = obtainTargetConnectionFactory( this.sendConnectionFactorySelectorExpression, message); if (this.usePublisherConnection && connectionFactory.getPublisherConnectionFactory() != null) { connectionFactory = connectionFactory.getPublisherConnectionFactory(); } DirectReplyToMessageListenerContainer container = this.directReplyToContainers.get(connectionFactory); if (container == null) { synchronized (this.directReplyToContainers) { container = this.directReplyToContainers.get(connectionFactory); if (container == null) { container = new DirectReplyToMessageListenerContainer(connectionFactory); container.setMessageListener(this); container.setBeanName(this.beanName + "#" + this.containerInstance.getAndIncrement()); if (this.taskExecutor != null) { container.setTaskExecutor(this.taskExecutor); } if (this.afterReceivePostProcessors != null) { container.setAfterReceivePostProcessors(this.afterReceivePostProcessors .toArray(new MessagePostProcessor[this.afterReceivePostProcessors.size()])); } container.start(); this.directReplyToContainers.put(connectionFactory, container); this.replyAddress = Address.AMQ_RABBITMQ_REPLY_TO; } } } ChannelHolder channelHolder = container.getChannelHolder(); try { return doSendAndReceiveAsListener(exchange, routingKey, message, correlationData, channelHolder.getChannel()); } catch (Exception e) { container.releaseConsumerFor(channelHolder, false, null); throw RabbitExceptionTranslator.convertRabbitAccessException(e); } }