shaofengshi commented on a change in pull request #301: KYLIN-3633 Avoid 
potential dead lock when building global dictionary
URL: https://github.com/apache/kylin/pull/301#discussion_r227015785
 
 

 ##########
 File path: 
core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryGenerator.java
 ##########
 @@ -75,13 +75,19 @@ public static IDictionaryBuilder 
newDictionaryBuilder(DataType dataType) {
         builder.init(dictInfo, baseId, null);
 
         // add values
-        while (valueEnumerator.moveNext()) {
-            String value = valueEnumerator.current();
+        try {
+            while (valueEnumerator.moveNext()) {
+                String value = valueEnumerator.current();
 
-            boolean accept = builder.addValue(value);
+                boolean accept = builder.addValue(value);
 
-            if (accept && samples.size() < nSamples && samples.contains(value) 
== false)
-                samples.add(value);
+                if (accept && samples.size() < nSamples && 
samples.contains(value) == false)
+                    samples.add(value);
+            }
+        } catch (Throwable e) {
 
 Review comment:
   Use "Throwable" is not recommended; please use a concrete exception type 
instead.

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


With regards,
Apache Git Services

Reply via email to