summaryrefslogtreecommitdiffstats
path: root/common/src/main/java/org
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-09-03 13:59:40 +0000
committerGerrit Code Review <gerrit@onap.org>2020-09-03 13:59:40 +0000
commit500125059ec5f831f26e1f22b3ec99a04970a2d2 (patch)
treef2e7b996f469ebed87427c3b48916aa273dd11db /common/src/main/java/org
parent89b24e3d8beda1bdacd2037ca957b0eadf59b897 (diff)
parent88e0584de928798e459f694dc1498b27f4f98163 (diff)
Merge "Added logging and try/catch to external task."
Diffstat (limited to 'common/src/main/java/org')
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java17
1 files changed, 16 insertions, 1 deletions
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<ExternalTaskClient> 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<ExternalTaskClient> getClients() {