mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 10:59:03 +00:00
#587 SonarQube reports bugs reader-writer-lock and refactor
Keeping wait() calls with in synchronized block closely to adhere SonarQube rules. Avoid nested synchronized block by extracting method. Added writing and reading time to simulate testing to ensure 1) writers are waiting for globalMutex to be empty 2) readers to confirm there is no writers.
This commit is contained in:
+1
-1
@@ -52,6 +52,6 @@ public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
}
|
||||
|
||||
public boolean logContains(String message) {
|
||||
return log.stream().anyMatch(event -> event.getFormattedMessage().equals(message));
|
||||
return log.stream().anyMatch(event -> event.getFormattedMessage().contains(message));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user