Simplified 'External' lock reason Mapping
[cps.git] / cps-ncmp-service / src / main / java / org / onap / cps / ncmp / api / inventory / sync / ModuleSyncWatchdog.java
index 6ec4419..0330991 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * ============LICENSE_START=======================================================
+ *  ============LICENSE_START=======================================================
  *  Copyright (C) 2022 Nordix Foundation
  *  Modifications Copyright (C) 2022 Bell Canada
  *  ================================================================================
@@ -61,7 +61,7 @@ public class ModuleSyncWatchdog {
             } catch (final Exception e) {
                 setCompositeStateToLocked().accept(compositeState);
                 syncUtils.updateLockReasonDetailsAndAttempts(compositeState,
-                        LockReasonCategory.LOCKED_MISBEHAVING, e.getMessage());
+                        LockReasonCategory.LOCKED_MODULE_SYNC_FAILED, e.getMessage());
             }
             inventoryPersistence.saveCmHandleState(cmHandleId, compositeState);
             log.debug("{} is now in {} state", cmHandleId, compositeState.getCmHandleState().name());
@@ -75,14 +75,14 @@ public class ModuleSyncWatchdog {
      */
     @Scheduled(fixedDelayString = "${timers.locked-modules-sync.sleep-time-ms:300000}")
     public void executeLockedCmHandlePoll() {
-        final List<YangModelCmHandle> lockedMisbehavingCmHandles = syncUtils.getLockedMisbehavingYangModelCmHandles();
-        for (final YangModelCmHandle moduleSyncFailedCmHandle : lockedMisbehavingCmHandles) {
-            final CompositeState compositeState = moduleSyncFailedCmHandle.getCompositeState();
+        final List<YangModelCmHandle> lockedCmHandles = syncUtils.getModuleSyncFailedCmHandles();
+        for (final YangModelCmHandle lockedCmHandle : lockedCmHandles) {
+            final CompositeState compositeState = lockedCmHandle.getCompositeState();
             final boolean isReadyForRetry = syncUtils.isReadyForRetry(compositeState);
             if (isReadyForRetry) {
                 setCompositeStateToAdvisedAndRetainOldLockReasonDetails(compositeState);
-                log.debug("Locked misbehaving cm handle {} is being recycled", moduleSyncFailedCmHandle.getId());
-                inventoryPersistence.saveCmHandleState(moduleSyncFailedCmHandle.getId(), compositeState);
+                log.debug("Locked cm handle {} is being resynced", lockedCmHandle.getId());
+                inventoryPersistence.saveCmHandleState(lockedCmHandle.getId(), compositeState);
             }
         }
     }