summaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/main/java/org/onap
diff options
context:
space:
mode:
authorKrzysztof Opasiak <k.opasiak@samsung.com>2019-01-30 19:55:20 +0100
committerKrzysztof Opasiak <k.opasiak@samsung.com>2019-02-08 16:05:52 +0100
commitcc4897a71480906b33e1c27d1b48b5a9017f86aa (patch)
tree8f060ca8b9a2e3cf78e5609b7e98e9a9826f6bf1 /policy-endpoints/src/main/java/org/onap
parent0c59da823026c29d6a7c243c74e8f858c20b8f75 (diff)
Return true only if thread has been really started
Accortding to doc start() should return true if start operation was successful. Unfortunately value of this.alive may change between end of synchronized block and return for example when other thread executes stop() in parallel. Change-Id: I4103f0f4c65620c47b4acf2d276f104937b91187 Issue-ID: POLICY-1387 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Diffstat (limited to 'policy-endpoints/src/main/java/org/onap')
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java
index 4cc8fbb1..83f3760b 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java
@@ -172,6 +172,7 @@ public abstract class SingleThreadedBusTopicSource extends BusTopicBase
this.busPollerThread = makePollerThread();
this.busPollerThread.setName(this.getTopicCommInfrastructure() + "-source-" + this.getTopic());
busPollerThread.start();
+ return true;
} catch (Exception e) {
logger.warn("{}: cannot start because of {}", this, e.getMessage(), e);
throw new IllegalStateException(e);
@@ -179,7 +180,7 @@ public abstract class SingleThreadedBusTopicSource extends BusTopicBase
}
}
- return this.alive;
+ return false;
}
/**