package org.oransc.enrichment.repository;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import lombok.Getter;
@Getter
private final String producerSupervisionCallbackUrl;
+ private final Set<String> enabledJobs = new HashSet<>();
+
private int unresponsiveCounter = 0;
public EiProducer(String id, Collection<EiType> eiTypes, String jobCallbackUrl,
return this.unresponsiveCounter == 0;
}
+ public synchronized void setJobEnabled(EiJob job) {
+ this.enabledJobs.add(job.getId());
+ }
+
+ public synchronized void setJobDisabled(EiJob job) {
+ this.enabledJobs.remove(job.getId());
+ }
+
+ /**
+ * Is the job enabled for this producer?
+ */
+ public synchronized boolean isJobEnabled(EiJob job) {
+ return this.enabledJobs.contains(job.getId());
+ }
+
}