commit | a282cc965e44b44ec15150716ea3cc115f917349 | [log] [tgz] |
---|---|---|
author | Sven Selberg <svense@axis.com> | Fri Dec 28 09:33:26 2018 +0100 |
committer | Sven Selberg <svense@axis.com> | Tue Jan 08 09:59:56 2019 +0100 |
tree | e286955bba425874fc3cc942046e50811f2f2931 | |
parent | 7047e985fafcaaa7716d33e10c97c69134657f37 [diff] |
Catch ShutDownSignalException when closing connection ShutDownSignalException is thrown when the connection is closing or is already closed. The recommended pattern is to try to close and catch ShutDownSignalException instead of checking if the connection is closed due to race conditions. Change-Id: Ibcaec0c0008201a282bf344c639a2a2c734d99c1
diff --git a/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/session/type/AMQPSession.java b/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/session/type/AMQPSession.java index 3ae3104..5523b16 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/session/type/AMQPSession.java +++ b/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/session/type/AMQPSession.java
@@ -189,8 +189,8 @@ LOGGER.info(MSG("Closing Connection...")); connection.close(); } - } catch (IOException ex) { - LOGGER.error(MSG("Error when closing connection."), ex); + } catch (IOException | ShutdownSignalException ex) { + LOGGER.warn(MSG("Error when closing connection."), ex); } finally { connection = null; }