Skip to content

Commit becedd1

Browse files
author
Emile Joubert
committed
Close channel at timeout when waiting for confirms
1 parent 54fcb2c commit becedd1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,14 @@ public void waitForConfirmsOrDie()
215215
public void waitForConfirmsOrDie(long timeout)
216216
throws IOException, InterruptedException, TimeoutException
217217
{
218-
if (!waitForConfirms(timeout)) {
219-
close(AMQP.REPLY_SUCCESS, "NACKS RECEIVED", true, null, false);
220-
throw new IOException("nacks received");
218+
try {
219+
if (!waitForConfirms(timeout)) {
220+
close(AMQP.REPLY_SUCCESS, "NACKS RECEIVED", true, null, false);
221+
throw new IOException("nacks received");
222+
}
223+
} catch (TimeoutException e) {
224+
close(AMQP.PRECONDITION_FAILED, "TIMEOUT WAITING FOR ACK");
225+
throw(e);
221226
}
222227
}
223228

0 commit comments

Comments
 (0)