You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2017/12/07 21:17:52 UTC

[GitHub] eolivelli commented on a change in pull request #821: Use ConcurrentLongLongHashMap in EntryLogMetadata

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:
users@infra.apache.org


With regards,
Apache Git Services