Skip to content

Commit 767e380

Browse files
committed
Merge default into 19129
2 parents 04f1571 + e3dcfb0 commit 767e380

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ public void processShutdownSignal(ShutdownSignalException signal,
236236
ensureIsOpen(); // invariant: we should never be shut down more than once per instance
237237
if (isOpen())
238238
_shutdownCause = signal;
239-
setBlockContent(true);
239+
240+
notifyAll();
240241
}
241242
} finally {
242243
if (notifyRpc)
@@ -257,14 +258,6 @@ public synchronized void transmit(Method m) throws IOException {
257258

258259
public synchronized void transmit(AMQCommand c) throws IOException {
259260
ensureIsOpen();
260-
if (c.getMethod().hasContent()) {
261-
while (_blockContent) {
262-
try {
263-
wait();
264-
} catch (InterruptedException e) {}
265-
ensureIsOpen();
266-
}
267-
}
268261
quiescingTransmit(c);
269262
}
270263

@@ -273,13 +266,20 @@ public synchronized void quiescingTransmit(Method m) throws IOException {
273266
}
274267

275268
public synchronized void quiescingTransmit(AMQCommand c) throws IOException {
269+
if (c.getMethod().hasContent()) {
270+
while (_blockContent) {
271+
try {
272+
wait();
273+
} catch (InterruptedException e) {}
274+
275+
// This is to catch a situation when the thread wakes up during
276+
// shutdown. Currently, no command that has content is allowed
277+
// to send anything in a closing state.
278+
ensureIsOpen();
279+
}
280+
}
276281
c.transmit(this);
277282
}
278-
279-
public synchronized void setBlockContent(boolean active) {
280-
_blockContent = !active;
281-
notifyAll();
282-
}
283283

284284
public AMQConnection getAMQConnection() {
285285
return _connection;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,9 @@ public void releaseChannelNumber() {
232232
} else if (method instanceof Channel.Flow) {
233233
Channel.Flow channelFlow = (Channel.Flow) method;
234234
synchronized(this) {
235-
setBlockContent(channelFlow.active);
235+
_blockContent = !channelFlow.active;
236236
transmit(new Channel.FlowOk(channelFlow.active));
237+
notifyAll();
237238
}
238239
return true;
239240
} else {

0 commit comments

Comments
 (0)