From 83b32b54863c96c5f4e06fe6b3856d0ee329d43d Mon Sep 17 00:00:00 2001 From: Kalin Kostashki Date: Mon, 28 Oct 2024 10:30:05 +0200 Subject: [PATCH] properly handled InterruptedException Signed-off-by: Kalin Kostashki --- .../messaging/internal/WebSocketMessagingProvider.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/java/src/main/java/org/eclipse/ditto/client/messaging/internal/WebSocketMessagingProvider.java b/java/src/main/java/org/eclipse/ditto/client/messaging/internal/WebSocketMessagingProvider.java index 27c2716b..1f4956d6 100644 --- a/java/src/main/java/org/eclipse/ditto/client/messaging/internal/WebSocketMessagingProvider.java +++ b/java/src/main/java/org/eclipse/ditto/client/messaging/internal/WebSocketMessagingProvider.java @@ -372,10 +372,15 @@ public void onConnected(final WebSocket websocket, final Map emitting subscriptionMessages: {}", subscriptionMessages); subscriptionMessages.values().forEach(this::emit); } - } catch (TimeoutException | InterruptedException | ExecutionException e) { + } catch (TimeoutException | ExecutionException e) { isReconnecting.complete(false); fixedRateChecker.cancel(true); LOGGER.error("Reconnecting failed: {}", e.getMessage()); + } catch (InterruptedException e) { + isReconnecting.complete(false); + fixedRateChecker.cancel(true); + LOGGER.error("Reconnecting failed due to thread being interrupted: {}", e.getMessage()); + Thread.currentThread().interrupt(); } } });