summaryrefslogtreecommitdiffstats
path: root/engine-d/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'engine-d/src/main/java/org')
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/dmaap/DMaaPAlarmPolling.java3
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java12
2 files changed, 7 insertions, 8 deletions
diff --git a/engine-d/src/main/java/org/onap/holmes/engine/dmaap/DMaaPAlarmPolling.java b/engine-d/src/main/java/org/onap/holmes/engine/dmaap/DMaaPAlarmPolling.java
index 862895b..935d2c8 100644
--- a/engine-d/src/main/java/org/onap/holmes/engine/dmaap/DMaaPAlarmPolling.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/dmaap/DMaaPAlarmPolling.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
package org.onap.holmes.engine.dmaap;
-
-import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
-
import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
diff --git a/engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java b/engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java
index 12edc99..c2fa5b8 100644
--- a/engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java
@@ -35,19 +35,21 @@ public class SubscriberAction {
private HashMap<String, DMaaPAlarmPolling> pollingTasks = new HashMap<>();
public synchronized void addSubscriber(Subscriber subscriber) {
- if (!pollingTasks.containsKey(subscriber.getTopic())) {
+ String topic = subscriber.getTopic();
+ if (topic != null && !pollingTasks.containsKey(topic)) {
DMaaPAlarmPolling pollingTask = new DMaaPAlarmPolling(subscriber, droolsEngine);
Thread thread = new Thread(pollingTask);
thread.start();
- pollingTasks.put(subscriber.getTopic(), pollingTask);
+ pollingTasks.put(topic, pollingTask);
log.info("Subscribe to topic: " + subscriber.getUrl());
}
}
public synchronized void removeSubscriber(Subscriber subscriber) {
- if (pollingTasks.containsKey(subscriber.getTopic())) {
- pollingTasks.get(subscriber.getTopic()).stopTask();
- pollingTasks.remove(subscriber.getTopic());
+ String topic = subscriber.getTopic();
+ if (topic != null && pollingTasks.containsKey(topic)) {
+ pollingTasks.get(topic).stopTask();
+ pollingTasks.remove(topic);
}
log.info("Topic unsubscribed: " + subscriber.getUrl());
}