summaryrefslogtreecommitdiffstats
path: root/engine-d/src/main/java/org/onap/holmes/engine/dmaappolling/SubscriberAction.java
diff options
context:
space:
mode:
authorShiwei Tian <tian.shiwei@zte.com.cn>2017-10-14 10:45:09 +0800
committerShiwei Tian <tian.shiwei@zte.com.cn>2017-10-14 10:56:39 +0800
commite540d3894d2f662a843e5c51535d44b876b9889f (patch)
tree469d7d56958242ad2774437ae3ea9d360a5b6475 /engine-d/src/main/java/org/onap/holmes/engine/dmaappolling/SubscriberAction.java
parent64fcc24209acc0c1d8097e2d10bd9cdef9c2b37c (diff)
modify not publish messages to DMaaP
Issue-ID: HOLMES-71 Change-Id: Iaf87f0250d043aae84e9afc6aaec0f6cdc0a529c Signed-off-by: Shiwei Tian <tian.shiwei@zte.com.cn>
Diffstat (limited to 'engine-d/src/main/java/org/onap/holmes/engine/dmaappolling/SubscriberAction.java')
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/dmaappolling/SubscriberAction.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/engine-d/src/main/java/org/onap/holmes/engine/dmaappolling/SubscriberAction.java b/engine-d/src/main/java/org/onap/holmes/engine/dmaappolling/SubscriberAction.java
index 1e71899..ef585d5 100644
--- a/engine-d/src/main/java/org/onap/holmes/engine/dmaappolling/SubscriberAction.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/dmaappolling/SubscriberAction.java
@@ -35,17 +35,19 @@ public class SubscriberAction {
private ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
public void addSubscriber(Subscriber subscriber) {
- DMaaPPollingRequest pollingTask = new DMaaPPollingRequest(subscriber, droolsEngine);
- ScheduledFuture future = service
- .scheduleAtFixedRate(pollingTask, 0, subscriber.getPeriod(), TimeUnit.MILLISECONDS);
- pollingRequests.put(subscriber.getTopic(), future);
+ if (!pollingRequests.containsKey(subscriber.getUrl())) {
+ DMaaPPollingRequest pollingTask = new DMaaPPollingRequest(subscriber, droolsEngine);
+ ScheduledFuture future = service
+ .scheduleAtFixedRate(pollingTask, 0, subscriber.getPeriod(), TimeUnit.MILLISECONDS);
+ pollingRequests.put(subscriber.getUrl(), future);
+ }
}
public void removeSubscriber(Subscriber subscriber) {
- ScheduledFuture future = pollingRequests.get(subscriber.getTopic());
+ ScheduledFuture future = pollingRequests.get(subscriber.getUrl());
if (future != null) {
future.cancel(true);
}
- pollingRequests.remove(subscriber.getTopic());
+ pollingRequests.remove(subscriber.getUrl());
}
}