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_r278283714
 
 

 ##########
 File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java
 ##########
 @@ -139,6 +143,10 @@ private ManagedLedgerFactoryImpl(BookKeeper bookKeeper, 
boolean isBookkeeperMana
         this.mbean = new ManagedLedgerFactoryMBeanImpl(this);
         this.entryCacheManager = new EntryCacheManager(this);
         this.statsTask = scheduledExecutor.scheduleAtFixedRate(() -> 
refreshStats(), 0, StatsPeriodSeconds, TimeUnit.SECONDS);
+        this.cacheEvictionTask = scheduledExecutor.scheduleAtFixedRate(() -> 
cacheEviction(), 0,
+                (long) (1000 / Math.min(config.getCacheEvictionFrequency(), 
1000.0)), TimeUnit.MILLISECONDS);
 
 Review comment:
   can we avoid `java.lang.ArithmeticException` when 
`config.getCacheEvictionFrequency()=0`?

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