smengcl commented on code in PR #4621:
URL: https://github.com/apache/ozone/pull/4621#discussion_r1185824861
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java:
##########
@@ -611,7 +630,12 @@ public synchronized CompletableFuture<Void>
add(OMClientResponse response,
private synchronized boolean canFlush() {
try {
while (currentBuffer.size() == 0) {
- wait(Long.MAX_VALUE);
+ wait(1000L);
+ if (currentBuffer.size() == 0) {
+ // Both buffers are empty, so notify twice
+ flushNotifier.notifyFlush();
+ flushNotifier.notifyFlush();
+ }
Review Comment:
Make sense.
In this case we could just remove inner `if` right? So the while-loop would
become:
```java
while (currentBuffer.size() == 0) {
// Both buffers are empty at this point, notify twice
flushNotifier.notifyFlush();
flushNotifier.notifyFlush();
wait(1000L);
}
```
Also now that we both asked the same question. It might be worth writing
that down in the code comment. :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]