Add webserver support for mr simulator
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / tasks / ServiceSupervision.java
index 4be26eb..751c0ac 100644 (file)
@@ -47,6 +47,7 @@ import reactor.core.publisher.Mono;
  */
 @Component
 @EnableScheduling
+@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
 public class ServiceSupervision {
     private static final Logger logger = LoggerFactory.getLogger(ServiceSupervision.class);
     private final Services services;
@@ -104,9 +105,7 @@ public class ServiceSupervision {
     }
 
     private Flux<Policy> getAllPoliciesForService(Service service) {
-        synchronized (policies) {
-            return Flux.fromIterable(policies.getForService(service.getName()));
-        }
+        return Flux.fromIterable(policies.getForService(service.getName()));
     }
 
     private Mono<Policy> deletePolicyInRic(Policy policy) {
@@ -116,9 +115,9 @@ public class ServiceSupervision {
                 .map(nothing -> policy));
     }
 
-    @SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
     private Mono<String> handleDeleteFromRicFailure(Policy policy, Throwable e) {
-        logger.warn("Could not delete policy: {} from ric: {}", policy.id(), policy.ric().name(), e);
+        logger.warn("Could not delete policy: {} from ric: {}. Cause: {}", policy.id(), policy.ric().name(),
+            e.getMessage());
         return Mono.empty();
     }
 }