From 88e0584de928798e459f694dc1498b27f4f98163 Mon Sep 17 00:00:00 2001 From: "Boslet, Cory" Date: Mon, 31 Aug 2020 15:17:38 -0400 Subject: Added logging and try/catch to external task. Added logging and try/catch to external task. Issue-ID: SO-3210 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Id3769b5bfb02bc439863d4a92c0e2937c9f4255f --- .../org/onap/so/utils/ExternalTaskServiceUtils.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'common/src/main/java/org/onap') diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java index fff82ea5bc..33958a7850 100644 --- a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java +++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java @@ -1,8 +1,10 @@ package org.onap.so.utils; import java.security.GeneralSecurityException; +import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; import org.camunda.bpm.client.ExternalTaskClient; import org.camunda.bpm.client.interceptor.ClientRequestInterceptor; import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider; @@ -75,7 +77,20 @@ public class ExternalTaskServiceUtils { @ScheduledLogging @Scheduled(fixedDelay = 30000) public void checkAllClientsActive() { - getClients().stream().filter(client -> !client.isActive()).forEach(ExternalTaskClient::start); + try { + logger.debug("Executing scheduled task to check and restart external task clients"); // TODO remove + // eventually + List inactiveClients = + getClients().stream().filter(client -> !client.isActive()).collect(Collectors.toList()); + + inactiveClients.forEach(c -> { + logger.debug("External Task Client found to be inactive. Restarting Client."); + c.start(); + }); + } catch (Exception e) { + logger.error("Exception occured in checkAllClientsActive", e); + } + } protected Set getClients() { -- cgit 1.2.3-korg