Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Introduce rAPP Catalogue API
[nonrtric.git]
/
enrichment-coordinator-service
/
src
/
main
/
java
/
org
/
oransc
/
enrichment
/
repository
/
EiTypes.java
diff --git
a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiTypes.java
b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiTypes.java
index
5454e8a
..
9b7b640
100644
(file)
--- a/
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiTypes.java
+++ b/
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiTypes.java
@@
-20,18
+20,23
@@
package org.oransc.enrichment.repository;
package org.oransc.enrichment.repository;
+import java.lang.invoke.MethodHandles;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import org.oransc.enrichment.exceptions.ServiceException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import org.oransc.enrichment.exceptions.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Dynamic representation of all EI Types in the system.
*/
/**
* Dynamic representation of all EI Types in the system.
*/
+@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
public class EiTypes {
public class EiTypes {
- Map<String, EiType> allEiTypes = new HashMap<>();
+ private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ private final Map<String, EiType> allEiTypes = new HashMap<>();
public synchronized void put(EiType type) {
allEiTypes.put(type.getId(), type);
public synchronized void put(EiType type) {
allEiTypes.put(type.getId(), type);
@@
-69,4
+74,12
@@
public class EiTypes {
this.allEiTypes.clear();
}
this.allEiTypes.clear();
}
+ public void deregisterType(EiType type, EiJobs eiJobs) {
+ this.remove(type);
+ for (EiJob job : eiJobs.getJobsForType(type.getId())) {
+ eiJobs.remove(job);
+ this.logger.warn("Deleted job {} because no producers left", job.id());
+ }
+ }
+
}
}