cmick commented on a change in pull request #16333:
URL: https://github.com/apache/flink/pull/16333#discussion_r663920066



##########
File path: 
flink-connectors/flink-connector-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSource.java
##########
@@ -273,44 +276,56 @@ public void open(Configuration config) throws Exception {
     @Override
     public void close() throws Exception {
         super.close();
+        Exception exception = null;
 
         try {
             if (consumer != null && channel != null) {
                 channel.basicCancel(consumer.getConsumerTag());
             }
         } catch (IOException e) {
-            throw new RuntimeException(
-                    "Error while cancelling RMQ consumer on "
-                            + queueName
-                            + " at "
-                            + rmqConnectionConfig.getHost(),
-                    e);
+            exception =
+                    new RuntimeException(
+                            "Error while cancelling RMQ consumer on "
+                                    + queueName
+                                    + " at "
+                                    + rmqConnectionConfig.getHost(),
+                            e);
         }
 
         try {
             if (channel != null) {
                 channel.close();
             }
         } catch (IOException e) {
-            throw new RuntimeException(
-                    "Error while closing RMQ channel with "
-                            + queueName
-                            + " at "
-                            + rmqConnectionConfig.getHost(),
-                    e);
+            exception =
+                    ExceptionUtils.firstOrSuppressed(
+                            new RuntimeException(
+                                    "Error while closing RMQ channel with "
+                                            + queueName
+                                            + " at "
+                                            + rmqConnectionConfig.getHost(),
+                                    e),

Review comment:
       PR for back-ports ready (#16377 and #16378). The only change (for both) 
is related to `Assert.assertThrows`. Works great here, but the previous 
releases depended on older junit 4.12 which did not have such a feature. I had 
to use a bit more cumbersome approach (using junit rules as this seems to be 
standard practice), but the logic remained the same.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to