kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mahong...@apache.org
Subject kylin git commit: KYLIN-1297 add more trace log
Date Fri, 08 Jan 2016 09:13:33 GMT
Repository: kylin
Updated Branches:
  refs/heads/2.0-rc cfc7e365c -> dd9ce9866


KYLIN-1297 add more trace log


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/dd9ce986
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/dd9ce986
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/dd9ce986

Branch: refs/heads/2.0-rc
Commit: dd9ce9866c94fca0407c3ad4247d29daf172e697
Parents: cfc7e36
Author: honma <honma@ebay.com>
Authored: Fri Jan 8 17:13:08 2016 +0800
Committer: honma <honma@ebay.com>
Committed: Fri Jan 8 17:13:23 2016 +0800

----------------------------------------------------------------------
 .../apache/kylin/dict/DictionaryManager.java    | 30 +++++++++++++-------
 1 file changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/dd9ce986/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
index f2a7a87..b3cd634 100644
--- a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
+++ b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
@@ -45,6 +45,8 @@ import org.slf4j.LoggerFactory;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
 import com.google.common.collect.Lists;
 
 public class DictionaryManager {
@@ -82,18 +84,23 @@ public class DictionaryManager {
 
     private DictionaryManager(KylinConfig config) {
         this.config = config;
-        this.dictCache = CacheBuilder.newBuilder().maximumSize(KylinConfig.getInstanceFromEnv().getCachedDictMaxEntrySize())//
-                .expireAfterWrite(1, TimeUnit.DAYS).build(new CacheLoader<String, DictionaryInfo>()
{
+        this.dictCache = CacheBuilder.newBuilder().removalListener(new RemovalListener<String,
DictionaryInfo>() {
             @Override
-            public DictionaryInfo load(String key) throws Exception {
-                DictionaryInfo dictInfo = DictionaryManager.this.load(key, true);
-                if (dictInfo == null) {
-                    return NONE_INDICATOR;
-                } else {
-                    return dictInfo;
-                }
+            public void onRemoval(RemovalNotification<String, DictionaryInfo> notification)
{
+                DictionaryManager.logger.info("Dict with resource path " + notification.getKey()
+ " is removed due to " + notification.getCause());
             }
-        });
+        }).maximumSize(KylinConfig.getInstanceFromEnv().getCachedDictMaxEntrySize())//
+                .expireAfterWrite(1, TimeUnit.DAYS).build(new CacheLoader<String, DictionaryInfo>()
{
+                    @Override
+                    public DictionaryInfo load(String key) throws Exception {
+                        DictionaryInfo dictInfo = DictionaryManager.this.load(key, true);
+                        if (dictInfo == null) {
+                            return NONE_INDICATOR;
+                        } else {
+                            return dictInfo;
+                        }
+                    }
+                });
     }
 
     public Dictionary<?> getDictionary(String resourcePath) throws IOException {
@@ -319,6 +326,7 @@ public class DictionaryManager {
     }
 
     public void removeDictionary(String resourcePath) throws IOException {
+        logger.info("Remvoing dict: " + resourcePath);
         ResourceStore store = MetadataManager.getInstance(config).getStore();
         store.deleteResource(resourcePath);
         dictCache.invalidate(resourcePath);
@@ -357,7 +365,7 @@ public class DictionaryManager {
     DictionaryInfo load(String resourcePath, boolean loadDictObj) throws IOException {
         ResourceStore store = MetadataManager.getInstance(config).getStore();
 
-        logger.debug("Loading DictionaryInfo(loadDictObj:" + loadDictObj + ") from " + resourcePath);
+        logger.info("DictionaryManager(" + System.identityHashCode(this) + ") loading DictionaryInfo(loadDictObj:"
+ loadDictObj + ") at " + resourcePath);
         DictionaryInfo info = store.getResource(resourcePath, DictionaryInfo.class, loadDictObj
? DictionaryInfoSerializer.FULL_SERIALIZER : DictionaryInfoSerializer.INFO_SERIALIZER);
 
         //        if (loadDictObj)


Mime
View raw message