/**
* 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
+@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
public class RicSupervision {
private static final Logger logger = LoggerFactory.getLogger(RicSupervision.class);
@Scheduled(fixedRate = 1000 * 60)
public void checkAllRics() {
logger.debug("Checking Rics starting");
- createTask().subscribe(ric -> logger.debug("Ric: {} checked", ric.ric.name()), //
+ createTask().subscribe( //
+ ric -> logger.debug("Ric: {} checked", ric.ric.name()), //
null, //
- () -> logger.debug("Checking Rics completed"));
+ () -> logger.debug("Checking Rics completed") //
+ );
}
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) {
}
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) {