diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java index cc0d1c67..f17411c9 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 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,7 @@ public abstract class AbstractConnectionFactory implements ConnectionFactory, Di private List
addresses; - private AddressShuffleMode addressShuffleMode = AddressShuffleMode.NONE; + private AddressShuffleMode addressShuffleMode = AddressShuffleMode.RANDOM; private int closeTimeout = DEFAULT_CLOSE_TIMEOUT; @@ -523,21 +523,6 @@ public abstract class AbstractConnectionFactory implements ConnectionFactory, Di return this.beanName; } - /** - * When {@link #setAddresses(String) addresses} are provided and there is more than - * one, set to true to shuffle the list before opening a new connection so that the - * connection to the broker will be attempted in random order. - * @param shuffleAddresses true to shuffle the list. - * @since 2.1.8 - * @deprecated since 2.3 in favor of - * @see Collections#shuffle(List) - * {@link #setAddressShuffleMode(AddressShuffleMode)}. - */ - @Deprecated - public void setShuffleAddresses(boolean shuffleAddresses) { - setAddressShuffleMode(AddressShuffleMode.RANDOM); - } - /** * Set the mode for shuffling addresses. * @param addressShuffleMode the address shuffle mode. diff --git a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryTests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryTests.java index 7534b465..5126ea9a 100644 --- a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryTests.java +++ b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 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,6 +24,7 @@ import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.BDDMockito.given; @@ -65,6 +66,7 @@ import org.apache.commons.logging.Log; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatcher; import org.mockito.InOrder; import org.springframework.amqp.AmqpConnectException; @@ -1657,8 +1659,10 @@ public class CachingConnectionFactoryTests extends AbstractConnectionFactoryTest ccf.createConnection(); verify(mock).isAutomaticRecoveryEnabled(); verify(mock).setAutomaticRecoveryEnabled(false); - verify(mock).newConnection(isNull(), - eq(Arrays.asList(new Address("mq1"), new Address("mq2"))), anyString()); + verify(mock).newConnection( + isNull(), + argThat((ArgumentMatcher