eolivelli commented on a change in pull request #821: Use
ConcurrentLongLongHashMap in EntryLogMetadata
URL: https://github.com/apache/bookkeeper/pull/821#discussion_r155642893
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogMetadata.java
##########
@@ -86,10 +74,20 @@ public long getRemainingSize() {
return remainingSize;
}
- Map<Long, Long> getLedgersMap() {
+ ConcurrentLongLongHashMap getLedgersMap() {
return ledgersMap;
}
+ public void removeLedgerIf(LongPredicate predicate) {
+ ledgersMap.removeIf((ledgerId, size) -> {
+ boolean shouldRemove = predicate.test(ledgerId);
+ if (shouldRemove) {
+ remainingSize -= size;
Review comment:
This is interesting, if we had a standard ConcurrentHashMap the count could
be wrong.
But in our implementation the predicate is executed only once.
----------------------------------------------------------------
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