anmolnar commented on a change in pull request #877: ZOOKEEPER-3338: Review of
BufferStats Class
URL: https://github.com/apache/zookeeper/pull/877#discussion_r272584272
##########
File path:
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/BufferStats.java
##########
@@ -40,50 +41,50 @@
private int maxBufferSize = INIT_VALUE;
/**
- * Size of the last buffer usage.
+ * Updates statistics by setting the last buffer usage size.
+ *
+ * @param value The last buffer size; must be equal to or greater than 0
*/
- public synchronized int getLastBufferSize() {
- return lastBufferSize;
+ public synchronized void setLastBufferSize(final int value) {
+ this.lastBufferSize = value;
+ this.minBufferSize = minBufferSize < 0 ? value :
Math.min(minBufferSize, value);
Review comment:
This logic is based on the assumption that `INIT_VALUE` is negative. A bit
fragile.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services