[ 
https://issues.apache.org/jira/browse/FLINK-8645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16371505#comment-16371505
 ] 

ASF GitHub Bot commented on FLINK-8645:
---------------------------------------

Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5544#discussion_r169660742
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java ---
    @@ -86,11 +86,42 @@
         * </ul>
         */
        public static final ConfigOption<String> ALWAYS_PARENT_FIRST_LOADER = 
ConfigOptions
    -           .key("classloader.parent-first-patterns")
    +           .key("classloader.parent-first-patterns.base")
                
.defaultValue("java.;scala.;org.apache.flink.;com.esotericsoftware.kryo;org.apache.hadoop.;javax.annotation.;org.slf4j;org.apache.log4j;org.apache.logging.log4j;ch.qos.logback")
    +           .withDeprecatedKeys("classloader.parent-first-patterns")
                .withDescription("A (semicolon-separated) list of patterns that 
specifies which classes should always be" +
                        " resolved through the parent ClassLoader first. A 
pattern is a simple prefix that is checked against" +
    -                   " the fully qualified class name.");
    +                   " the fully qualified class name. This setting should 
generally not be modified. To add another pattern we" +
    +                   " recommend to use 
\"classloader.parent-first-patterns.append\" instead.");
    +
    +   public static final ConfigOption<String> 
ALWAYS_PARENT_FIRST_LOADER_APPEND = ConfigOptions
    +           .key("classloader.parent-first-patterns.append")
    +           .defaultValue("")
    +           .withDescription("A (semicolon-separated) list of patterns that 
specifies which classes should always be" +
    +                   " resolved through the parent ClassLoader first. A 
pattern is a simple prefix that is checked against" +
    +                   " the fully qualified class name. These patterns are 
appended to \"" + ALWAYS_PARENT_FIRST_LOADER.key() + "\".");
    +
    +   private static final String[] EMPTY_STRING_ARRAY = new String[0];
    --- End diff --
    
    This is meant well (as in fewer objects), but given that this is used only 
once (or few times), the JVM has more overhead through this additional static 
field (managing class and reflection metadata) than if the method 
`getParentFirstLoaderPatterns()` just does a `new String[0]`, especially 
because it will be a very short lived object.
    



> Support convenient extension of parent-first ClassLoader patterns
> -----------------------------------------------------------------
>
>                 Key: FLINK-8645
>                 URL: https://issues.apache.org/jira/browse/FLINK-8645
>             Project: Flink
>          Issue Type: Improvement
>          Components: Configuration
>    Affects Versions: 1.5.0
>            Reporter: Chesnay Schepler
>            Assignee: Chesnay Schepler
>            Priority: Major
>
> The option {{classloader.parent-first-patterns}} defines a list of class 
> pattern that should always be loaded through the parent class-loader. The 
> default value contains all classes that are effectively required to be loaded 
> that way for Flink to function.
> This list cannot be extended in a convenient way, as one would have to 
> manually copy the existing default and append new entries. This makes the 
> configuration brittle in light of version upgrades where we may extend the 
> default, and also obfuscates the configuration a bit.
> I propose to separate this option into 
> {{classloader.parent-first-patterns.base}}, which subsumes the existing 
> option, and {{classloader.parent-first-patterns.append}} which is 
> automatically appended to the base.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to