diff options
author | mpriyank <priyank.maheshwari@est.tech> | 2022-08-23 12:31:23 +0100 |
---|---|---|
committer | mpriyank <priyank.maheshwari@est.tech> | 2022-08-23 12:50:07 +0100 |
commit | 10317d3502c18c8013ae11d3c18e29b40db151d1 (patch) | |
tree | 9aaaa575b74d539e87af48b8a02e14877af9cab6 | |
parent | f71863640945153a163c1f51f88f9a799733e24e (diff) |
Performance Improvement: LCM Events
- Changed scope of method responsible for creating and publishing the
LCM events.
- Use a dedicated thread pool for publishing the LCM events.
Issue-ID: CPS-1223
Change-Id: Ib46e3c1ff8d80f724ad9db30fca6e8125ca0775a
Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2 files changed, 21 insertions, 8 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsCmHandleStateHandler.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsCmHandleStateHandler.java index 8cab19405e..c428b12924 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsCmHandleStateHandler.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsCmHandleStateHandler.java @@ -22,6 +22,7 @@ package org.onap.cps.ncmp.api.impl.event.lcm; import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle; import org.onap.cps.ncmp.api.inventory.CmHandleState; +import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle; /** * The implementation of it should handle the persisting of composite state and delegate the request to publish the @@ -36,4 +37,13 @@ public interface LcmEventsCmHandleStateHandler { * @param targetCmHandleState target cm handle state */ void updateCmHandleState(final YangModelCmHandle yangModelCmHandle, final CmHandleState targetCmHandleState); + + /** + * Publish LCM Event. + * + * @param targetNcmpServiceCmHandle target NcmpServiceCmHandle + * @param existingNcmpServiceCmHandle existing NcmpServiceCmHandle + */ + void publishLcmEvent(final NcmpServiceCmHandle targetNcmpServiceCmHandle, + final NcmpServiceCmHandle existingNcmpServiceCmHandle); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsCmHandleStateHandlerImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsCmHandleStateHandlerImpl.java index fd46ee8604..7719e1b239 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsCmHandleStateHandlerImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsCmHandleStateHandlerImpl.java @@ -35,6 +35,7 @@ import org.onap.cps.ncmp.api.inventory.CompositeStateUtils; import org.onap.cps.ncmp.api.inventory.InventoryPersistence; import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle; import org.onap.ncmp.cmhandle.event.lcm.LcmEvent; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @Slf4j @@ -64,6 +65,16 @@ public class LcmEventsCmHandleStateHandlerImpl implements LcmEventsCmHandleState } + @Async("notificationExecutor") + @Override + public void publishLcmEvent(final NcmpServiceCmHandle targetNcmpServiceCmHandle, + final NcmpServiceCmHandle existingNcmpServiceCmHandle) { + final String cmHandleId = targetNcmpServiceCmHandle.getCmHandleId(); + final LcmEvent lcmEvent = + lcmEventsCreator.populateLcmEvent(cmHandleId, targetNcmpServiceCmHandle, existingNcmpServiceCmHandle); + lcmEventsService.publishLcmEvent(cmHandleId, lcmEvent); + } + private void updateToSpecifiedCmHandleState(final YangModelCmHandle yangModelCmHandle, final CmHandleState targetCmHandleState) { @@ -95,14 +106,6 @@ public class LcmEventsCmHandleStateHandlerImpl implements LcmEventsCmHandleState inventoryPersistence.saveCmHandle(yangModelCmHandle); } - private void publishLcmEvent(final NcmpServiceCmHandle targetNcmpServiceCmHandle, - final NcmpServiceCmHandle existingNcmpServiceCmHandle) { - final String cmHandleId = targetNcmpServiceCmHandle.getCmHandleId(); - final LcmEvent lcmEvent = - lcmEventsCreator.populateLcmEvent(cmHandleId, targetNcmpServiceCmHandle, existingNcmpServiceCmHandle); - lcmEventsService.publishLcmEvent(cmHandleId, lcmEvent); - } - private void updateAndSaveCmHandleState(final YangModelCmHandle yangModelCmHandle, final CmHandleState targetCmHandleState) { setCmHandleState(yangModelCmHandle, targetCmHandleState); |