merlimat commented on a change in pull request #220: BOOKKEEPER-1095: Long Poll - Server and Client Side Changes URL: https://github.com/apache/bookkeeper/pull/220#discussion_r127154693
########## File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileInfo.java ########## @@ -102,14 +101,34 @@ synchronized Long getLastAddConfirmed() { return lac; } - synchronized long setLastAddConfirmed(long lac) { - if (null == this.lac || this.lac < lac) { - this.lac = lac; + long setLastAddConfirmed(long lac) { + long lacToReturn; + synchronized (this) { + if (null == this.lac || this.lac < lac) { + this.lac = lac; + setChanged(); + } + lacToReturn = this.lac; + } + LOG.trace("Updating LAC {} , {}", lacToReturn, lac); + + + notifyObservers(new LastAddConfirmedUpdateNotification(lacToReturn)); Review comment: Would it be easy to avoid allocating the wrapper object `LastAddConfirmedUpdateNotification`, at least in the case where there are no registered observers? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services