Skip to content

Commit 170061e

Browse files
author
Simon MacMullen
committed
Check exception error code.
1 parent 1223706 commit 170061e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/src/com/rabbitmq/examples/perf/MulticastParams.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package com.rabbitmq.examples.perf;
1818

19+
import com.rabbitmq.client.AMQP;
1920
import com.rabbitmq.client.Channel;
21+
import com.rabbitmq.client.Command;
2022
import com.rabbitmq.client.Connection;
2123
import com.rabbitmq.client.ShutdownSignalException;
2224

@@ -218,11 +220,15 @@ private static boolean exists(Connection connection, Checker checker) throws IOE
218220
return true;
219221
}
220222
catch (IOException e) {
221-
if (e.getCause() instanceof ShutdownSignalException) {
222-
return false;
223-
} else {
224-
throw e;
223+
ShutdownSignalException sse = (ShutdownSignalException) e.getCause();
224+
Command closeCommand = (Command) sse.getReason();
225+
if (!sse.isHardError()) {
226+
AMQP.Channel.Close closeMethod = (AMQP.Channel.Close) closeCommand.getMethod();
227+
if (closeMethod.getReplyCode() == AMQP.PRECONDITION_FAILED) {
228+
return false;
229+
}
225230
}
231+
throw e;
226232
}
227233
}
228234
}

0 commit comments

Comments
 (0)