summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/main
diff options
context:
space:
mode:
authorleventecsanyi <levente.csanyi@est.tech>2023-09-26 12:57:57 +0200
committerleventecsanyi <levente.csanyi@est.tech>2023-09-26 14:19:30 +0200
commit928c1eba5aa5271903fdfb70e5b81fa60c1eb9bb (patch)
tree198dba97856279e0004ebba18f0607140f6a4b25 /cps-ncmp-service/src/main
parentfbc17e6df9192a9a7bd257d47a07e30ab7ff3322 (diff)
Introduce and use new Hazelcast map for module set tag
- added new IMap for moduleSetTags, updated SynchronizationCacheConfigSpec - updated deployment.rst Issue-ID: CPS-1859 Signed-off-by: leventecsanyi <levente.csanyi@est.tech> Change-Id: I5233c5150fd784974d7c1e5ba387119c1eaba194
Diffstat (limited to 'cps-ncmp-service/src/main')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfig.java14
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/inventory/sync/ModuleSyncWatchdog.java2
2 files changed, 16 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfig.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfig.java
index 62a380ca5c..8b28717db4 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfig.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfig.java
@@ -23,6 +23,7 @@ package org.onap.cps.ncmp.api.impl.config.embeddedcache;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.QueueConfig;
import com.hazelcast.map.IMap;
+import java.util.Set;
import java.util.concurrent.BlockingQueue;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.cache.HazelcastCacheConfig;
@@ -44,6 +45,8 @@ public class SynchronizationCacheConfig extends HazelcastCacheConfig {
private static final MapConfig moduleSyncStartedConfig = createMapConfig("moduleSyncStartedConfig");
private static final MapConfig dataSyncSemaphoresConfig = createMapConfig("dataSyncSemaphoresConfig");
+ private static final MapConfig moduleSetTagCacheMapConfig = createMapConfig("moduleSetTagCacheMapConfig");
+
/**
* Module Sync Distributed Queue Instance.
*
@@ -74,4 +77,15 @@ public class SynchronizationCacheConfig extends HazelcastCacheConfig {
public IMap<String, Boolean> dataSyncSemaphores() {
return createHazelcastInstance("dataSyncSemaphores", dataSyncSemaphoresConfig).getMap("dataSyncSemaphores");
}
+
+ /**
+ * IMap instance for cached ModulesSetTags.
+ *
+ * @return configured map of ModuleSetTags
+ */
+ @Bean
+ public IMap<String, Set<String>> moduleSetTagCache() {
+ return createHazelcastInstance("moduleSetTags", moduleSetTagCacheMapConfig)
+ .getMap("moduleSetTagCache");
+ }
}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/inventory/sync/ModuleSyncWatchdog.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/inventory/sync/ModuleSyncWatchdog.java
index 916fafd302..6ba52ee16c 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/inventory/sync/ModuleSyncWatchdog.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/inventory/sync/ModuleSyncWatchdog.java
@@ -25,6 +25,7 @@ import com.hazelcast.map.IMap;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@@ -48,6 +49,7 @@ public class ModuleSyncWatchdog {
private final IMap<String, Object> moduleSyncStartedOnCmHandles;
private final ModuleSyncTasks moduleSyncTasks;
private final AsyncTaskExecutor asyncTaskExecutor;
+ private final IMap<String, Set<String>> moduleSetTagCache;
private static final int MODULE_SYNC_BATCH_SIZE = 100;
private static final long PREVENT_CPU_BURN_WAIT_TIME_MILLIS = 10;
private static final String VALUE_FOR_HAZELCAST_IN_PROGRESS_MAP = "Started";