jengebr commented on code in PR #2593: URL: https://github.com/apache/logging-log4j2/pull/2593#discussion_r1613588442
########## log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java: ########## @@ -316,17 +303,7 @@ public static void remove(final String key) { * @since 2.8 */ public static void removeAll(final Iterable<String> keys) { - if (contextMap instanceof CleanableThreadContextMap) { - ((CleanableThreadContextMap) contextMap).removeAll(keys); - } else if (contextMap instanceof DefaultThreadContextMap) { - ((DefaultThreadContextMap) contextMap).removeAll(keys); - } else if (contextMap instanceof StringArrayThreadContextMap) { - ((StringArrayThreadContextMap) contextMap).removeAll(keys); - } else { - for (final String key : keys) { - contextMap.remove(key); - } - } + contextMap.removeAll(keys); Review Comment: Please maintain separate if/else branches for the most common instance types, as in the previous version. This avoids virtual method lookups for those types. -- 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. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org