}
ric.setState(RicState.SYNCHRONIZING);
}
- ric.getLock().lockBlocking(LockType.EXCLUSIVE); // Make sure no NBI updates are running
- ric.getLock().unlock();
- this.a1ClientFactory.createA1Client(ric)//
+
+ ric.getLock().lock(LockType.EXCLUSIVE) // Make sure no NBI updates are running
+ .flatMap(lock -> lock.unlock()) //
+ .flatMap(lock -> this.a1ClientFactory.createA1Client(ric)) //
.flatMapMany(client -> startSynchronization(ric, client)) //
.subscribe(x -> logger.debug("Synchronize: {}", x), //
throwable -> onSynchronizationError(ric, throwable), //
@SuppressWarnings("squid:S2629")
private void onSynchronizationError(Ric ric, Throwable t) {
logger.warn("Synchronization failed for ric: {}, reason: {}", ric.name(), t.getMessage());
- // If recovery fails, try to remove all instances
+ // If synchronization fails, try to remove all instances
deleteAllPoliciesInRepository(ric);
Flux<PolicyType> recoverTypes = this.a1ClientFactory.createA1Client(ric) //