Skip to content

Commit e636d40

Browse files
committed
Revert changes to RabbitUtils
1 parent a043dc4 commit e636d40

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/RabbitUtils.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -229,18 +229,12 @@ public static void setPhysicalCloseRequired(Channel channel, boolean b) {
229229
public static boolean isPhysicalCloseRequired() {
230230
Boolean mustClose = physicalCloseRequired.get();
231231
if (mustClose == null) {
232-
return false;
232+
mustClose = Boolean.FALSE;
233233
}
234234
else {
235-
return mustClose;
235+
physicalCloseRequired.remove();
236236
}
237-
}
238-
239-
/**
240-
* Clear the physicalCloseRequired flag.
241-
*/
242-
public static void clearPhysicalCloseRequired() {
243-
physicalCloseRequired.remove();
237+
return mustClose;
244238
}
245239

246240
/**

spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/ClientRecoveryCompatibilityTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@ public class ClientRecoveryCompatibilityTests {
4343

4444
@Test
4545
public void testDefeatRecovery() throws Exception {
46-
RabbitUtils.clearPhysicalCloseRequired(); // left over from some other test
4746
final Channel channel1 = mock(Channel.class);
4847
when(channel1.isOpen()).thenReturn(true);
4948
final Channel channel2 = mock(Channel.class);
@@ -75,7 +74,7 @@ public void testDefeatRecovery() throws Exception {
7574
Connection conn3 = ccf.createConnection();
7675
assertThat(conn3).isSameAs(conn1);
7776
assertThatExceptionOfType(AutoRecoverConnectionNotCurrentlyOpenException.class).isThrownBy(() ->
78-
conn3.createChannel(false))
77+
conn3.createChannel(false))
7978
.withMessage("Auto recovery connection is not currently open");
8079
channel = conn2.createChannel(false);
8180
proxy = (ChannelProxy) channel;

0 commit comments

Comments
 (0)