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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org