#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:
mahendran.mookkiah
2017-08-18 20:44:28 -04:00
parent f47dc1eb7c
commit 51751ec821
5 changed files with 128 additions and 76 deletions
@@ -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));
}
}