T3 fixing sonar problems
Change-Id: I6d9985eb19928dc5e090d3de7619ccb4441dc7f2
diff --git a/apps/t3/src/main/java/org/onosproject/t3/impl/Generator.java b/apps/t3/src/main/java/org/onosproject/t3/impl/Generator.java
index 1f6bf22..95e4d4e 100644
--- a/apps/t3/src/main/java/org/onosproject/t3/impl/Generator.java
+++ b/apps/t3/src/main/java/org/onosproject/t3/impl/Generator.java
@@ -31,15 +31,19 @@
synchronized void set() {
isSet = true;
- notify();
+ notifyAll();
}
synchronized void await() throws InterruptedException {
try {
+
if (isSet) {
return;
}
- wait();
+
+ while (!isSet) {
+ wait();
+ }
} finally {
isSet = false;
}
@@ -113,8 +117,10 @@
private void startProducer() {
assert producer == null;
- if (threadGroup == null) {
- threadGroup = new ThreadGroup("onos-t3-generator");
+ synchronized (this) {
+ if (threadGroup == null) {
+ threadGroup = new ThreadGroup("onos-t3-generator");
+ }
}
producer = new Thread(threadGroup, () -> {
try {