StevenLuMT commented on code in PR #3192:
URL: https://github.com/apache/bookkeeper/pull/3192#discussion_r930132496
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedReadChannel.java:
##########
@@ -95,9 +98,10 @@ public synchronized int read(ByteBuf dest, long pos, int
length) throws IOExcept
throw new IOException("Reading from filechannel returned a
non-positive value. Short read.");
}
readBuffer.writerIndex(readBytes);
+ bytesFetchedFromFile += readBytes;
}
}
- return (int) (currentPosition - pos);
+ return new ImmutablePair<> ((int) (currentPosition - pos),
bytesFetchedFromFile);
Review Comment:
@hangc0276 @dlg99
I think you can write like this simple code :
`return Pair.of((int) (currentPosition - pos), bytesFetchedFromFile); `
instead of
`return new ImmutablePair<> ((int) (currentPosition - pos),
bytesFetchedFromFile); `
but I think it's ok, frequent creation of ImmutablePair has no affect
<img width="964" alt="image"
src="https://user-images.githubusercontent.com/42990025/181050024-667fd915-ba55-4de9-9bb1-da395b60391e.png">
--
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]