Skip to content

Commit ec0d423

Browse files
committed
SonarQube fix try 3
1 parent 992d899 commit ec0d423

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

microservices-log-aggregation/src/main/java/com/iluwatar/logaggregation/LogAggregator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private void startBufferFlusher() {
130130
*/
131131
public void bufferWake() {
132132
synchronized (bufferWait) {
133-
bufferWait.notify();
133+
bufferWait.notifyAll();
134134
}
135135
}
136136
}

queue-based-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/TaskGenerator.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ public TaskGenerator(MessageQueue msgQueue, int msgCount) {
5050
*/
5151
public void submit(Message msg) {
5252
try {
53-
synchronized (msg) {
54-
this.msgQueue.submitMsg(msg);
55-
}
53+
this.msgQueue.submitMsg(msg);
5654
} catch (Exception e) {
5755
LOGGER.error(e.getMessage());
5856
}
@@ -68,12 +66,8 @@ public void run() {
6866
try {
6967
while (count > 0) {
7068
var statusMsg = "Message-" + count + " submitted by " + Thread.currentThread().getName();
71-
Message msg = new Message(statusMsg);
72-
synchronized (msg) {
73-
this.submit(msg);
74-
LOGGER.info(statusMsg);
75-
}
76-
69+
LOGGER.info(statusMsg);
70+
this.submit(new Message(statusMsg));
7771

7872
// reduce the message count.
7973
count--;

0 commit comments

Comments
 (0)