rdhabalia commented on a change in pull request #4066: Allow to configure the 
managed ledger cache eviction frequency
URL: https://github.com/apache/pulsar/pull/4066#discussion_r277904774
 
 

 ##########
 File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java
 ##########
 @@ -147,15 +151,34 @@ private synchronized void refreshStats() {
 
         mbean.refreshStats(period, TimeUnit.NANOSECONDS);
         ledgers.values().forEach(mlfuture -> {
-            ManagedLedgerImpl ml = mlfuture.getNow(null);
-            if (ml != null) {
-                ml.mbean.refreshStats(period, TimeUnit.NANOSECONDS);
+            if (mlfuture.isDone() && !mlfuture.isCompletedExceptionally()) {
+                ManagedLedgerImpl ml = mlfuture.getNow(null);
+                if (ml != null) {
+                    ml.mbean.refreshStats(period, TimeUnit.NANOSECONDS);
+                }
             }
         });
 
         lastStatTimestamp = now;
     }
 
+    private synchronized void cacheEviction() {
+        long now = System.nanoTime();
+        long period = now - lastCacheEvictionTimestamp;
+        long maxTimestamp = now - period;
 
 Review comment:
   umm.. it seems like `maxTimestamp` is `lastCacheEvictionTimestamp` only? so, 
we want to evict all the entries which are older than 
`lastCacheEvictionTimestamp` right? then can we directly use 
`lastCacheEvictionTimestamp`?

----------------------------------------------------------------
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

Reply via email to