Skip to content

Commit 84e678f

Browse files
author
Steve Powell
committed
Factor out common sequence for channel.close in ChannelN.processAsync()
1 parent add7bbc commit 84e678f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/com/rabbitmq/client/impl/ChannelN.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,16 @@ public void releaseChannelNumber() {
230230
// incoming commands except for a close and close-ok.
231231

232232
Method method = command.getMethod();
233+
// we deal with channel.close in the same way, regardless
234+
if (method instanceof Channel.Close) {
235+
asyncShutdown(command);
236+
return true;
237+
}
233238

234239
if (isOpen()) {
235240
// We're in normal running mode.
236241

237-
if (method instanceof Channel.Close) {
238-
asyncShutdown(command);
239-
return true;
240-
} else if (method instanceof Basic.Deliver) {
242+
if (method instanceof Basic.Deliver) {
241243
Basic.Deliver m = (Basic.Deliver) method;
242244

243245
Consumer callback = _consumers.get(m.consumerTag);
@@ -343,11 +345,7 @@ public void releaseChannelNumber() {
343345
} else {
344346
// We're in quiescing mode == !isOpen()
345347

346-
if (method instanceof Channel.Close) {
347-
// We are already shutting down, but we cannot assume no Rpc is waiting.
348-
asyncShutdown(command);
349-
return true;
350-
} else if (method instanceof Channel.CloseOk) {
348+
if (method instanceof Channel.CloseOk) {
351349
// We're quiescing, and we see a channel.close-ok:
352350
// this is our signal to leave quiescing mode and
353351
// finally shut down for good. Let it be handled as an

0 commit comments

Comments
 (0)