Merge "Added check of callback URL in service registration"
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / tasks / RicSupervision.java
index d368fc4..c2dd18e 100644 (file)
@@ -43,7 +43,8 @@ import reactor.core.publisher.Mono;
 
 /**
  * Regularly checks the existing rics towards the local repository to keep it
- * consistent.
+ * consistent. When the policy types or instances in the Near-RT RIC is not
+ * consistent, a synchronization is performed.
  */
 @Component
 @EnableScheduling
@@ -81,12 +82,11 @@ public class RicSupervision {
     }
 
     private Flux<RicData> createTask() {
-        synchronized (this.rics) {
-            return Flux.fromIterable(rics.getRics()) //
-                .flatMap(this::createRicData) //
-                .flatMap(this::checkOneRic) //
-                .onErrorResume(throwable -> Mono.empty());
-        }
+        return Flux.fromIterable(rics.getRics()) //
+            .flatMap(this::createRicData) //
+            .flatMap(this::checkOneRic) //
+            .onErrorResume(throwable -> Mono.empty());
+
     }
 
     private Mono<RicData> checkOneRic(RicData ricData) {
@@ -115,7 +115,7 @@ public class RicSupervision {
     }
 
     private Mono<RicData> checkRicState(RicData ric) {
-        if (ric.ric.getState() == RicState.UNDEFINED) {
+        if (ric.ric.getState() == RicState.UNAVAILABLE) {
             return startSynchronization(ric) //
                 .onErrorResume(t -> Mono.empty());
         } else if (ric.ric.getState() == RicState.SYNCHRONIZING) {