From 7d646e675ab6b6d41c534ab22f4fd51d15ee3a7d Mon Sep 17 00:00:00 2001 From: Stoyan Tzenkov Date: Wed, 31 Jul 2019 14:51:03 +0300 Subject: [PATCH] Shutting down channel in Communicator to account service. Signed-off-by: Stoyan Tzenkov --- .../AccountServiceCommunicator.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/biz/nynja/auth/grpc/integrations/AccountServiceCommunicator.java b/src/main/java/biz/nynja/auth/grpc/integrations/AccountServiceCommunicator.java index 2114a80..8ef1286 100644 --- a/src/main/java/biz/nynja/auth/grpc/integrations/AccountServiceCommunicator.java +++ b/src/main/java/biz/nynja/auth/grpc/integrations/AccountServiceCommunicator.java @@ -116,6 +116,10 @@ public class AccountServiceCommunicator { } catch (Exception ex) { logger.error("Account service unavailable, message = {}, cause = {}", ex.getMessage(), ex.getCause()); throw new InternalError(ex.getMessage(), new InternalError(Cause.ACCOUNT_SERVICE_UNAVAILABLE.name())); + } finally { + if (managedChannel != null) { + managedChannel.shutdown(); + } } return response; } @@ -147,6 +151,10 @@ public class AccountServiceCommunicator { } catch (Exception ex) { logger.error("Account service unavailable, message = {}, cause = {}", ex.getMessage(), ex.getCause()); throw new InternalError(ex.getMessage(), new InternalError(Cause.ACCOUNT_SERVICE_UNAVAILABLE.name())); + } finally { + if (managedChannel != null) { + managedChannel.shutdown(); + } } return response; } @@ -178,6 +186,10 @@ public class AccountServiceCommunicator { } catch (Exception ex) { logger.error("Account service unavailable, message = {}, cause = {}", ex.getMessage(), ex.getCause()); throw new InternalError(ex.getMessage(), new InternalError(Cause.ACCOUNT_SERVICE_UNAVAILABLE.name())); + } finally { + if (managedChannel != null) { + managedChannel.shutdown(); + } } return account; } @@ -210,6 +222,10 @@ public class AccountServiceCommunicator { } catch (Exception ex) { logger.error("Account service unavailable, message = {}, cause = {}", ex.getMessage(), ex.getCause()); throw new InternalError(ex.getMessage(), new InternalError(Cause.ACCOUNT_SERVICE_UNAVAILABLE.name())); + } finally { + if (managedChannel != null) { + managedChannel.shutdown(); + } } return account; } @@ -237,6 +253,10 @@ public class AccountServiceCommunicator { } catch (Exception ex) { logger.error("Account service unavailable, message = {}, cause = {}", ex.getMessage(), ex.getCause()); throw new InternalError(ex.getMessage(), new InternalError(Cause.ACCOUNT_SERVICE_UNAVAILABLE.name())); + } finally { + if (managedChannel != null) { + managedChannel.shutdown(); + } } return accountResponse; } -- GitLab