sijie commented on a change in pull request #817: Client times out requests in
batch rather than individually
URL: https://github.com/apache/bookkeeper/pull/817#discussion_r155136221
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
##########
@@ -768,6 +763,30 @@ public void getBookieInfo(final long requested,
GetBookieInfoCallback cb, Object
writeAndFlush(channel, completionKey, getBookieInfoRequest);
}
+ private static BiPredicate<CompletionKey, CompletionValue> timeoutCheck =
(key, value) -> {
+ return value.maybeTimeout();
+ };
+
+ public void checkTimeoutOnPendingOperations() {
+ int timedOutOperations = completionObjects.removeIf(timeoutCheck);
+
+ synchronized (this) {
+ Iterator<CompletionValue> iterator =
completionObjectsV2Conflicts.values().iterator();
+ while (iterator.hasNext()) {
+ CompletionValue value = iterator.next();
+ if (value.maybeTimeout()) {
+ ++timedOutOperations;
+ iterator.remove();
+ }
+ }
+ }
+
+ if (timedOutOperations > 0) {
+ LOG.info("Timed-out {} operations to channel {} for {}",
+ new Object[] { timedOutOperations, channel, addr });
Review comment:
nit: you don't need `new Object[]` for the current version of slf4j
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services