diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/IdempotentReceiverAutoProxyCreator.java b/spring-integration-core/src/main/java/org/springframework/integration/config/IdempotentReceiverAutoProxyCreator.java index 94cbd6d6d1..2443f491ac 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/IdempotentReceiverAutoProxyCreator.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/IdempotentReceiverAutoProxyCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2015 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. @@ -37,18 +37,19 @@ import org.springframework.util.PatternMatchUtils; * to {@link MessageHandler}s mapped by their {@code endpoint beanName}. * * @author Artem Bilan + * @author Gary Russell * @since 4.1 */ @SuppressWarnings("serial") class IdempotentReceiverAutoProxyCreator extends AbstractAutoProxyCreator { - private List> idempotentEndpointsMapping; + private volatile List> idempotentEndpointsMapping; - private Map> idempotentEndpoints; + private volatile Map> idempotentEndpoints; // double check locking requires volatile public void setIdempotentEndpointsMapping(List> idempotentEndpointsMapping) { Assert.notEmpty(idempotentEndpointsMapping); - this.idempotentEndpointsMapping = idempotentEndpointsMapping; + this.idempotentEndpointsMapping = idempotentEndpointsMapping;//NOSONAR (inconsistent sync) } @Override @@ -82,7 +83,7 @@ class IdempotentReceiverAutoProxyCreator extends AbstractAutoProxyCreator { } private void initIdempotentEndpointsIfNecessary() { - if (this.idempotentEndpoints == null) { + if (this.idempotentEndpoints == null) {//NOSONAR (inconsistent sync) synchronized (this) { if (this.idempotentEndpoints == null) { this.idempotentEndpoints = new LinkedHashMap>(); 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 577c485fd2..f7870a8d0f 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 the original author or authors. + * Copyright 2014-2015 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. @@ -41,6 +41,7 @@ import org.springframework.util.StringUtils; * * @author David Liu * @author Artem Bilan + * @author Gary Russell * since 4.1 */ public abstract class AbstractMessageProducingHandler extends AbstractMessageHandler @@ -48,9 +49,9 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan protected final MessagingTemplate messagingTemplate = new MessagingTemplate(); - private MessageChannel outputChannel; + private volatile MessageChannel outputChannel; - private String outputChannelName; + private volatile String outputChannelName; /** * Set the timeout for sending reply Messages. @@ -67,7 +68,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan public void setOutputChannelName(String outputChannelName) { Assert.hasText(outputChannelName, "'outputChannelName' must not be empty"); - this.outputChannelName = outputChannelName; + this.outputChannelName = outputChannelName;//NOSONAR (inconsistent sync) } /** @@ -82,7 +83,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan @Override protected void onInit() throws Exception { super.onInit(); - Assert.state(!(this.outputChannelName != null && this.outputChannel != null), + Assert.state(!(this.outputChannelName != null && this.outputChannel != null),//NOSONAR (inconsistent sync) "'outputChannelName' and 'outputChannel' are mutually exclusive."); if (getBeanFactory() != null) { this.messagingTemplate.setBeanFactory(getBeanFactory());