diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java
index 7d23995b95..f331382473 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -407,16 +407,17 @@ public abstract class AbstractMessageChannel extends IntegrationObjectSupport
* is interrupted. If the specified timeout is 0, the method will return
* immediately. If less than zero, it will block indefinitely (see
* {@link #send(Message)}).
- * @param message the Message to send
+ * @param messageArg the Message to send
* @param timeout the timeout in milliseconds
* @return true if the message is sent successfully,
* false if the message cannot be sent within the allotted
* time or the sending thread is interrupted.
*/
@Override
- public boolean send(Message> message, long timeout) {
- Assert.notNull(message, "message must not be null");
- Assert.notNull(message.getPayload(), "message payload must not be null");
+ public boolean send(Message> messageArg, long timeout) {
+ Assert.notNull(messageArg, "message must not be null");
+ Assert.notNull(messageArg.getPayload(), "message payload must not be null");
+ Message> message = messageArg;
if (this.shouldTrack) {
message = MessageHistory.write(message, this, this.getMessageBuilderFactory());
}
@@ -596,8 +597,10 @@ public abstract class AbstractMessageChannel extends IntegrationObjectSupport
}
@Nullable
- public Message> preSend(Message> message, MessageChannel channel,
+ public Message> preSend(Message> messageArg, MessageChannel channel,
Deque interceptorStack) {
+
+ Message> message = messageArg;
if (this.size > 0) {
for (ChannelInterceptor interceptor : this.interceptors) {
Message> previous = message;
@@ -652,7 +655,8 @@ public abstract class AbstractMessageChannel extends IntegrationObjectSupport
}
@Nullable
- public Message> postReceive(Message> message, MessageChannel channel) {
+ public Message> postReceive(Message> messageArg, MessageChannel channel) {
+ Message> message = messageArg;
if (this.size > 0) {
for (ChannelInterceptor interceptor : this.interceptors) {
message = interceptor.postReceive(message, channel);
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java
index ba05858660..6563960cdb 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2016 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -124,9 +124,11 @@ public class PriorityChannel extends QueueChannel {
return false;
}
if (!this.useMessageStore) {
- message = new MessageWrapper(message);
+ return super.doSend(new MessageWrapper(message), 0);
+ }
+ else {
+ return super.doSend(message, 0);
}
- return super.doSend(message, 0);
}
@Override
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/InboundChannelAdapterAnnotationPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/InboundChannelAdapterAnnotationPostProcessor.java
index b983191328..03871dd9a0 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/InboundChannelAdapterAnnotationPostProcessor.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/InboundChannelAdapterAnnotationPostProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 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.
@@ -100,8 +100,10 @@ public class InboundChannelAdapterAnnotationPostProcessor extends
return adapter;
}
- private MessageSource> createMessageSource(Object bean, String beanName, Method method) {
+ private MessageSource> createMessageSource(Object beanArg, String beanName, Method methodArg) {
MessageSource> messageSource = null;
+ Object bean = beanArg;
+ Method method = methodArg;
if (AnnotatedElementUtils.isAnnotated(method, Bean.class.getName())) {
Object target = this.resolveTargetBeanFromMethodWithBeanAnnotation(method);
Class> targetClass = target.getClass();
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelParser.java
index b318e1865f..db6fc1bc10 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -36,6 +36,7 @@ import org.springframework.util.xml.DomUtils;
* @author Mark Fisher
* @author Dave Syer
* @author Artem Bilan
+ * @author Gary Russell
*/
public abstract class AbstractChannelParser extends AbstractBeanDefinitionParser {
@@ -86,10 +87,13 @@ public abstract class AbstractChannelParser extends AbstractBeanDefinitionParser
@Override
protected void registerBeanDefinition(BeanDefinitionHolder definition, BeanDefinitionRegistry registry) {
String scope = definition.getBeanDefinition().getScope();
- if (!AbstractBeanDefinition.SCOPE_DEFAULT.equals(scope) && !AbstractBeanDefinition.SCOPE_SINGLETON.equals(scope) && !AbstractBeanDefinition.SCOPE_PROTOTYPE.equals(scope)) {
- definition = ScopedProxyUtils.createScopedProxy(definition, registry, false);
+ if (!AbstractBeanDefinition.SCOPE_DEFAULT.equals(scope) && !AbstractBeanDefinition.SCOPE_SINGLETON.equals(scope)
+ && !AbstractBeanDefinition.SCOPE_PROTOTYPE.equals(scope)) {
+ super.registerBeanDefinition(ScopedProxyUtils.createScopedProxy(definition, registry, false), registry);
+ }
+ else {
+ super.registerBeanDefinition(definition, registry);
}
- super.registerBeanDefinition(definition, registry);
}
/**
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java
index d7625eb6f2..5011419ee2 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -39,6 +39,7 @@ import org.springframework.integration.transformer.support.ExpressionEvaluatingH
import org.springframework.integration.transformer.support.MessageProcessingHeaderValueMessageProcessor;
import org.springframework.integration.transformer.support.RoutingSlipHeaderValueMessageProcessor;
import org.springframework.integration.transformer.support.StaticHeaderValueMessageProcessor;
+import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.DomUtils;
@@ -148,11 +149,13 @@ public abstract class HeaderEnricherParserSupport extends AbstractTransformerPar
}
private void addHeader(Element element, ManagedMap headers, ParserContext parserContext,
- String headerName, Element headerElement, String headerType, String expression, String overwrite) {
+ String headerName, Element headerElement, String headerType, @Nullable String expressionArg,
+ String overwrite) {
String value = headerElement.getAttribute("value");
String ref = headerElement.getAttribute(REF_ATTRIBUTE);
String method = headerElement.getAttribute(METHOD_ATTRIBUTE);
+ String expression = expressionArg;
if (expression == null) {
expression = headerElement.getAttribute(EXPRESSION_ATTRIBUTE);
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java
index 5c60e64475..6d35d9ffbd 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -47,6 +47,7 @@ import org.springframework.integration.config.FixedSubscriberChannelBeanFactoryP
import org.springframework.integration.config.IntegrationConfigUtils;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.transaction.TransactionHandleMessageAdvice;
+import org.springframework.lang.Nullable;
import org.springframework.transaction.interceptor.DefaultTransactionAttribute;
import org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource;
import org.springframework.transaction.interceptor.TransactionInterceptor;
@@ -356,12 +357,14 @@ public abstract class IntegrationNamespaceUtils {
* @param rootBuilder The root builder.
* @param parserContext The parser context.
* @param headerMapperBuilder The header mapper builder.
- * @param replyHeaderValue The reply header value.
+ * @param replyHeaderValueArg The reply header value.
*/
public static void configureHeaderMapper(Element element, BeanDefinitionBuilder rootBuilder,
- ParserContext parserContext, BeanDefinitionBuilder headerMapperBuilder, String replyHeaderValue) {
+ ParserContext parserContext, BeanDefinitionBuilder headerMapperBuilder,
+ @Nullable String replyHeaderValueArg) {
String defaultMappedReplyHeadersAttributeName = "mapped-reply-headers";
+ String replyHeaderValue = replyHeaderValueArg;
if (!StringUtils.hasText(replyHeaderValue)) {
replyHeaderValue = defaultMappedReplyHeadersAttributeName;
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryException.java b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryException.java
index 8756719431..cfb2c8bba9 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryException.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -29,6 +29,7 @@ import org.springframework.util.StringUtils;
*
* @author Mark Fisher
* @author Artem Bilan
+ * @author Gary Russell
*
* @since 1.0.3
*/
@@ -67,12 +68,14 @@ public class AggregateMessageDeliveryException extends MessageDeliveryException
private String appendPeriodIfNecessary(String baseMessage) {
if (!StringUtils.hasText(baseMessage)) {
- baseMessage = "";
+ return "";
}
else if (!baseMessage.endsWith(".")) {
- baseMessage = baseMessage + ".";
+ return baseMessage + ".";
+ }
+ else {
+ return baseMessage;
}
- return baseMessage;
}
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java
index adac682722..d819046b25 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2018 the original author or authors.
+ * Copyright 2016-2019 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.
@@ -221,13 +221,16 @@ public final class IntegrationFlows {
* @see SourcePollingChannelAdapterSpec
*/
public static IntegrationFlowBuilder from(MessageSource> messageSource,
- Consumer endpointConfigurer) {
+ @Nullable Consumer endpointConfigurer) {
+
return from(messageSource, endpointConfigurer, null);
}
private static IntegrationFlowBuilder from(MessageSource> messageSource,
- Consumer endpointConfigurer,
- IntegrationFlowBuilder integrationFlowBuilder) {
+ @Nullable Consumer endpointConfigurer,
+ @Nullable IntegrationFlowBuilder integrationFlowBuilderArg) {
+
+ IntegrationFlowBuilder integrationFlowBuilder = integrationFlowBuilderArg;
SourcePollingChannelAdapterSpec spec = new SourcePollingChannelAdapterSpec(messageSource);
if (endpointConfigurer != null) {
endpointConfigurer.accept(spec);
@@ -262,7 +265,9 @@ public final class IntegrationFlows {
}
private static IntegrationFlowBuilder from(MessageProducerSupport messageProducer,
- IntegrationFlowBuilder integrationFlowBuilder) {
+ @Nullable IntegrationFlowBuilder integrationFlowBuilderArg) {
+
+ IntegrationFlowBuilder integrationFlowBuilder = integrationFlowBuilderArg;
MessageChannel outputChannel = messageProducer.getOutputChannel();
if (outputChannel == null) {
outputChannel = new DirectChannel();
@@ -354,8 +359,9 @@ public final class IntegrationFlows {
}
private static IntegrationFlowBuilder from(MessagingGatewaySupport inboundGateway,
- IntegrationFlowBuilder integrationFlowBuilder) {
+ @Nullable IntegrationFlowBuilder integrationFlowBuilderArg) {
+ IntegrationFlowBuilder integrationFlowBuilder = integrationFlowBuilderArg;
MessageChannel outputChannel = inboundGateway.getRequestChannel();
if (outputChannel == null) {
outputChannel = new DirectChannel();
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java
index 97234a5fc0..312ba080a6 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2018 the original author or authors.
+ * Copyright 2016-2019 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.
@@ -34,6 +34,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.support.context.NamedComponent;
+import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -124,7 +125,8 @@ public final class StandardIntegrationFlowContext implements IntegrationFlowCont
}
@SuppressWarnings("unchecked")
- private Object registerBean(Object bean, String beanName, String parentName) {
+ private Object registerBean(Object bean, @Nullable String beanNameArg, String parentName) {
+ String beanName = beanNameArg;
if (beanName == null) {
beanName = generateBeanName(bean, parentName);
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MessageProducerSupport.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MessageProducerSupport.java
index d920a31c14..b00d54ba96 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MessageProducerSupport.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MessageProducerSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -192,7 +192,8 @@ public abstract class MessageProducerSupport extends AbstractEndpoint implements
protected void doStop() {
}
- protected void sendMessage(Message> message) {
+ protected void sendMessage(Message> messageArg) {
+ Message> message = messageArg;
if (message == null) {
throw new MessagingException("cannot send a null message");
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java
index dc7fcbccb8..278dea6502 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -228,7 +228,8 @@ public class SourcePollingChannelAdapter extends AbstractPollingEndpoint
}
@Override
- protected void handleMessage(Message> message) {
+ protected void handleMessage(Message> messageArg) {
+ Message> message = messageArg;
if (this.shouldTrack) {
message = MessageHistory.write(message, this, getMessageBuilderFactory());
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java b/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java
index 5043169e7c..496ad4be79 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -408,9 +408,10 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc
* The holder can be null if not cached before, or a timed-out cache entry
* (potentially getting re-validated against the current last-modified timestamp).
* @param filename the bundle filename (basename + Locale)
- * @param propHolder the current PropertiesHolder for the bundle
+ * @param propHolderArg the current PropertiesHolder for the bundle
*/
- private PropertiesHolder refreshProperties(String filename, PropertiesHolder propHolder) {
+ private PropertiesHolder refreshProperties(String filename, @Nullable PropertiesHolder propHolderArg) {
+ PropertiesHolder propHolder = propHolderArg;
long refreshTimestamp = (this.cacheMillis < 0) ? -1 : System.currentTimeMillis();
Resource resource = this.resourceLoader.getResource(filename + PROPERTIES_SUFFIX);
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java
index 8b793821cb..b52595f52f 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -232,10 +232,9 @@ public abstract class MessagingGatewaySupport extends AbstractEndpoint
* from any object passed in a send or sendAndReceive operation.
* @param requestMapper The request mapper.
*/
- public void setRequestMapper(InboundMessageMapper> requestMapper) {
- requestMapper = (requestMapper != null) ? requestMapper : new DefaultRequestMapper();
- this.requestMapper = requestMapper;
- this.messageConverter.setInboundMessageMapper(requestMapper);
+ public void setRequestMapper(@Nullable InboundMessageMapper> requestMapper) {
+ this.requestMapper = (requestMapper != null) ? requestMapper : new DefaultRequestMapper();
+ this.messageConverter.setInboundMessageMapper(this.requestMapper);
}
/**
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java
index 78233062f1..43fdff213c 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -139,7 +139,8 @@ public abstract class AbstractMessageHandler extends IntegrationObjectSupport
}
@Override
- public void handleMessage(Message> message) {
+ public void handleMessage(Message> messageArg) {
+ Message> message = messageArg;
Assert.notNull(message, "Message must not be null");
Assert.notNull(message.getPayload(), "Message payload must not be null"); //NOSONAR - false positive
if (this.loggingEnabled && this.logger.isDebugEnabled()) {
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java
index 36889cb71d..3e99d5a364 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 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.
@@ -33,6 +33,7 @@ import org.springframework.integration.core.MessageProducer;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.routingslip.RoutingSlipRouteStrategy;
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
+import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandlingException;
@@ -205,12 +206,8 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan
@Override
public MessageChannel getOutputChannel() {
if (this.outputChannelName != null) {
- synchronized (this) {
- if (this.outputChannelName != null) {
- this.outputChannel = getChannelResolver().resolveDestination(this.outputChannelName);
- this.outputChannelName = null;
- }
- }
+ this.outputChannel = getChannelResolver().resolveDestination(this.outputChannelName);
+ this.outputChannelName = null;
}
return this.outputChannel;
}
@@ -235,9 +232,10 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan
return false;
}
- protected void produceOutput(Object reply, final Message> requestMessage) {
+ protected void produceOutput(Object replyArg, final Message> requestMessage) {
final MessageHeaders requestHeaders = requestMessage.getHeaders();
+ Object reply = replyArg;
Object replyChannel = null;
if (getOutputChannel() == null) {
Map, ?> routingSlipHeader = requestHeaders.get(IntegrationMessageHeaderAccessor.ROUTING_SLIP, Map.class);
@@ -252,20 +250,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan
AtomicInteger routingSlipIndex = new AtomicInteger((Integer) value);
replyChannel = getOutputChannelFromRoutingSlip(reply, requestMessage, routingSlip, routingSlipIndex);
if (replyChannel != null) {
- //TODO Migrate to the SF MessageBuilder
- AbstractIntegrationMessageBuilder> builder = null;
- if (reply instanceof Message) {
- builder = this.getMessageBuilderFactory().fromMessage((Message>) reply);
- }
- else if (reply instanceof AbstractIntegrationMessageBuilder) {
- builder = (AbstractIntegrationMessageBuilder>) reply;
- }
- else {
- builder = this.getMessageBuilderFactory().withPayload(reply);
- }
- builder.setHeader(IntegrationMessageHeaderAccessor.ROUTING_SLIP,
- Collections.singletonMap(routingSlip, routingSlipIndex.get()));
- reply = builder;
+ reply = addRoutingSlipHeader(reply, routingSlip, routingSlipIndex);
}
}
@@ -276,52 +261,16 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan
}
}
}
+ doProduceOutput(requestMessage, requestHeaders, reply, replyChannel);
+ }
+
+ private void doProduceOutput(final Message> requestMessage, final MessageHeaders requestHeaders, Object reply,
+ Object replyChannel) {
if (this.async && (reply instanceof ListenableFuture> || reply instanceof Publisher>)) {
if (reply instanceof ListenableFuture> ||
!(getOutputChannel() instanceof ReactiveStreamsSubscribableChannel)) {
- ListenableFuture> future;
- if (reply instanceof ListenableFuture>) {
- future = (ListenableFuture>) reply;
- }
- else {
- SettableListenableFuture