Skip to content

Commit 823ce39

Browse files
author
Hubert Plociniczak
committed
Do not throw AlreadyClosedException
1 parent df244fe commit 823ce39

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,11 @@ public synchronized void quiescingRpc(Method m, RpcContinuation k)
227227
public void processShutdownSignal(ShutdownSignalException signal, boolean ignoreClosed, boolean notifyRpc) {
228228
try {
229229
synchronized (this) {
230-
ensureIsOpen(); // invariant: we should never be shut down more than once per instance
231-
_shutdownCause = signal;
230+
if (!ignoreClosed)
231+
ensureIsOpen(); // invariant: we should never be shut down more than once per instance
232+
if (isOpen())
233+
_shutdownCause = signal;
232234
}
233-
} catch (AlreadyClosedException ace) {
234-
if (!ignoreClosed)
235-
throw ace;
236235
} finally {
237236
if (notifyRpc)
238237
notifyOutstandingRpc(signal);

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,14 +603,11 @@ public ShutdownSignalException shutdown(Object reason,
603603
ShutdownSignalException sse = new ShutdownSignalException(true,initiatedByApplication,
604604
reason, this);
605605
sse.initCause(cause);
606-
try {
607-
synchronized (this) {
606+
synchronized (this) {
607+
if (initiatedByApplication)
608608
ensureIsOpen(); // invariant: we should never be shut down more than once per instance
609+
if (isOpen())
609610
_shutdownCause = sse;
610-
}
611-
} catch (AlreadyClosedException ace) {
612-
if (initiatedByApplication)
613-
throw ace;
614611
}
615612
_channel0.processShutdownSignal(sse, !initiatedByApplication, notifyRpc);
616613
_channelManager.handleSignal(sse);

0 commit comments

Comments
 (0)