akashrn5 commented on a change in pull request #3580: [CARBONDATA-3665] Support 
TimeBased Cache expiration using Guava Cache
URL: https://github.com/apache/carbondata/pull/3580#discussion_r371007320
 
 

 ##########
 File path: 
core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java
 ##########
 @@ -1894,4 +1898,35 @@ public static String getDataMapStorageProvider() {
     }
     return provider.toUpperCase();
   }
+
+  /**
+   * This method validates the duration for carbon cache expiration
+   */
+  private void validateDurationForCacheExpiration() {
+    String defaultValue = Long.toString(
+        
CarbonCommonConstants.CARBON_LRU_CACHE_EXPIRATION_DURATION_IN_MINUTES_DEFAULT);
+    long duration;
+    try {
+      duration = Long.parseLong(
+          
carbonProperties.getProperty(CARBON_LRU_CACHE_EXPIRATION_DURATION_IN_MINUTES));
+      if (duration < 0 || duration == 0) {
+        LOGGER.info("using default value of 
carbon.lru.cache.expiration.duration.in.minutes = "
+            + 
CarbonCommonConstants.CARBON_LRU_CACHE_EXPIRATION_DURATION_IN_MINUTES_DEFAULT);
+        carbonProperties
+            
.setProperty(CarbonCommonConstants.CARBON_LOCAL_DICTIONARY_SIZE_THRESHOLD_IN_MB,
+                defaultValue);
+      } else {
+        LOGGER.info("using carbon.lru.cache.expiration.duration.in.minutes = " 
+ duration);
+        carbonProperties
+            .setProperty(CARBON_LRU_CACHE_EXPIRATION_DURATION_IN_MINUTES,
+                Long.toString(duration));
+      }
+    } catch (Exception e) {
 
 Review comment:
   In this method, only NumberFormatException will be thrown, i dont see any 
other type of exception. If not instead of generalised exception, use  
NumberFormatException.

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