summaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/main
diff options
context:
space:
mode:
authorKrzysztof Opasiak <k.opasiak@samsung.com>2019-01-30 14:10:35 +0100
committerKrzysztof Opasiak <k.opasiak@samsung.com>2019-01-31 21:16:49 +0100
commit0c59da823026c29d6a7c243c74e8f858c20b8f75 (patch)
tree529e487b16876746535d80c1a5392e55005ab8f0 /policy-endpoints/src/main
parent7df5aea14cfd8b46ba3a8bba7e3e76e7f0272e68 (diff)
Fix potential race condition
init() is currently called outside of synhronized block. This is may lead to race condition as init() creates new bus consumer (this.consumer) which is the copied and nulled in stop() synchronized block. This may lead to race condition if: Thread #1 Thread #2 this.alive = true; this.alive = false consumerCopy = this.consumer; this.consumer = new Consumer(); // false if(consumerCopy != null) { consumerCopy.close(); } else { log.warn(); } As a result, new BusConsumers are being created but they are never close(). Issue-ID: POLICY-1387 Change-Id: I2eadb12ef1c4b07b9e47dc6ebc096acc713299a0 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Diffstat (limited to 'policy-endpoints/src/main')
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java
index 93896898..d6ca824e 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java
@@ -93,10 +93,10 @@ public abstract class InlineBusTopicSink extends BusTopicBase implements BusTopi
throw new IllegalStateException(this + " is locked.");
}
+ this.init();
this.alive = true;
}
- this.init();
return true;
}