BinShi-SecularBird commented on a change in pull request #425: PHOENIX-5069 
please go to JIRA to see the detailed design document attached.
URL: https://github.com/apache/phoenix/pull/425#discussion_r246114544
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
 ##########
 @@ -59,22 +59,36 @@
 
     private final ConnectionQueryServices queryServices;
     private final LoadingCache<GuidePostsKey, GuidePostsInfo> cache;
+    private final ExecutorService executor;
 
     public GuidePostsCache(ConnectionQueryServices queryServices, 
Configuration config) {
         this.queryServices = Objects.requireNonNull(queryServices);
+
+        // The size of the thread pool used for refreshing cached table stats
+        final int statsCacheThreadPoolSize = config.getInt(
+                QueryServices.STATS_CACHE_THREAD_POOL_SIZE,
+                QueryServicesOptions.DEFAULT_STATS_CACHE_THREAD_POOL_SIZE);
+
+        executor = Executors.newFixedThreadPool(statsCacheThreadPoolSize);
 
 Review comment:
   OK, I changed to initialize thread pool only if stats are enabled.
   
   To the question "do we know why do we build the cache even when stats are 
disabled?", my thought is that this is fastest and simplest way to fix it, 
although it isn't the most efficient way.      Fixing in this way still 
provides the uniform interface to the callers of the GuidePostCache so the 
calls don't need to something like "if stats are enabled then call this; 
otherwise call that". One of efficient and formal ways to fix it is that we 
define the interface of GuidePostsCache, two classes implement the interface - 
one is GuidePostsEmptyCache and another is current GuidePostsCache. We create 
object of GuidePostsEmptyCache when stats are disabled.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to