GH-3469 New Sonar smell & volatile busyWaitMillis

Fixes https://github.com/spring-projects/spring-integration/issues/3469

* Fix new Sonar smells
* Mark `LockRegistryLeaderInitiator.busyWaitMillis` as `volatile`
so runtime changes (e.g. `RedisLockRegistryLeaderInitiatorTests`)
will make an immediate effect
This commit is contained in:
Artem Bilan
2021-01-21 14:55:14 -05:00
parent 58ce578a10
commit 8763c95622
17 changed files with 121 additions and 132 deletions

View File

@@ -39,7 +39,6 @@ import org.springframework.integration.redis.support.RedisHeaders;
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.MessagingException;
import org.springframework.messaging.converter.MessageConversionException;
import org.springframework.util.Assert;
@@ -209,7 +208,7 @@ public class ReactiveRedisStreamMessageProducer extends MessageProducerSupport {
* Configure a resume Function to resume the main sequence when polling the stream fails.
* Mutually exclusive with {@link #setStreamReceiverOptions(StreamReceiver.StreamReceiverOptions)}.
* By default this function extract the failed {@link Record} and sends an
* {@link org.springframework.messaging.support.ErrorMessage} to the provided {@link #setErrorChannel(MessageChannel)}.
* {@link org.springframework.messaging.support.ErrorMessage} to the provided {@link #setErrorChannel}.
* The failed message for this record may have a {@link IntegrationMessageHeaderAccessor#ACKNOWLEDGMENT_CALLBACK}
* header when manual acknowledgment is configured for this message producer.
* @param resumeFunction must not be null.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 the original author or authors.
* Copyright 2016-2021 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.
@@ -24,7 +24,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
@@ -54,7 +53,6 @@ public class RedisLockRegistryLeaderInitiatorTests extends RedisAvailableTests {
@Test
@RedisAvailable
@Ignore("Intermittent failures")
public void testDistributedLeaderElection() throws Exception {
RedisLockRegistry registry = new RedisLockRegistry(getConnectionFactoryForTest(), "LeaderInitiator");
registry.expireUnusedOlderThan(-1);