You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/08/01 18:32:50 UTC

[GitHub] [incubator-druid] leventov commented on a change in pull request #8157: Enum of ResponseContext keys

leventov commented on a change in pull request #8157: Enum of ResponseContext keys
URL: https://github.com/apache/incubator-druid/pull/8157#discussion_r309826852
 
 

 ##########
 File path: processing/src/main/java/org/apache/druid/query/context/ResponseContext.java
 ##########
 @@ -155,47 +159,60 @@
     CPU_CONSUMED_NANOS(
         "cpuConsumed",
             (oldValue, newValue) -> (long) oldValue + (long) newValue
+    ),
+    /**
+     * Indicates if a {@link ResponseContext} was truncated during serialization.
+     */
+    TRUNCATED(
+        "truncated",
+            (oldValue, newValue) -> (boolean) oldValue || (boolean) newValue
     );
 
     /**
      * TreeMap is used to have the natural ordering of its keys
      */
-    private static Map<String, BaseKey> map = new TreeMap<>();
+    private static final Map<String, BaseKey> registeredKeys = new TreeMap<>();
 
     static {
       for (BaseKey key : values()) {
-        addKey(key);
+        registerKey(key);
       }
     }
 
     /**
-     * The primary way of registering context keys.
-     * Only the keys registered this way are considered during the context merge.
+     * Primary way of registering context keys.
+     * @throws IllegalArgumentException if the key has already been registered.
      */
-    public static void addKey(BaseKey key)
+    public static void registerKey(BaseKey key)
 
 Review comment:
   Just in case, please make this method `synchronized`

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org