Apache9 commented on a change in pull request #673: HBASE-23093 : Avoid 
Optional Anti-Pattern where possible
URL: https://github.com/apache/hbase/pull/673#discussion_r333511518
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
 ##########
 @@ -152,14 +151,15 @@ public MetricsRegionServerWrapperImpl(final 
HRegionServer regionServer) {
   }
 
   private void initBlockCache() {
-    this.blockCache = this.regionServer.getBlockCache();
-    this.cacheStats = this.blockCache.map(BlockCache::getStats);
-    if (this.cacheStats.isPresent()) {
-      if (this.cacheStats.get() instanceof 
CombinedBlockCache.CombinedCacheStats) {
-        l1Stats = Optional
-            .of(((CombinedBlockCache.CombinedCacheStats) 
this.cacheStats.get()).getLruCacheStats());
-        l2Stats = Optional.of(((CombinedBlockCache.CombinedCacheStats) 
this.cacheStats.get())
-            .getBucketCacheStats());
+    this.blockCache = this.regionServer.getBlockCache().isPresent() ?
 
 Review comment:
   Just use orElse(null)?

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


With regards,
Apache Git Services

Reply via email to