[GitHub] [flink] horacehylee commented on a change in pull request #16821: [FLINK-23358][core] Refactor CoreOptions parent first patterns to List options

2021-10-08 Thread GitBox


horacehylee commented on a change in pull request #16821:
URL: https://github.com/apache/flink/pull/16821#discussion_r725431805



##
File path: 
flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
##
@@ -94,24 +101,39 @@
  * 
  */
 @Documentation.Section(Documentation.Sections.EXPERT_CLASS_LOADING)
-public static final ConfigOption 
ALWAYS_PARENT_FIRST_LOADER_PATTERNS =
+public static final ConfigOption> 
ALWAYS_PARENT_FIRST_LOADER_PATTERNS =
 ConfigOptions.key("classloader.parent-first-patterns.default")
-.defaultValue(
-
"java.;scala.;org.apache.flink.;com.esotericsoftware.kryo;org.apache.hadoop.;javax.annotation.;org.xml;javax.xml;org.apache.xerces;org.w3c;"
-+ PARENT_FIRST_LOGGING_PATTERNS)
+.stringType()
+.asList()
+.defaultValues(
+mergeListsToArray(
+Arrays.asList(
+"java.",
+"scala.",
+"org.apache.flink.",
+"com.esotericsoftware.kryo",
+"org.apache.hadoop.",
+"javax.annotation.",
+"org.xml",
+"javax.xml",
+"org.apache.xerces",
+"org.w3c"),
+PARENT_FIRST_LOGGING_PATTERNS))
 .withDeprecatedKeys("classloader.parent-first-patterns")
 .withDescription(
-"A (semicolon-separated) list of patterns that 
specifies which classes should always be"
+"A list of patterns that specifies which classes 
should always be"

Review comment:
   Sure, updated the description accordingly.

##
File path: 
flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
##
@@ -127,9 +149,13 @@
 + "thrown while trying to load a user code 
class.");
 
 public static String[] getParentFirstLoaderPatterns(Configuration config) {
-String base = config.getString(ALWAYS_PARENT_FIRST_LOADER_PATTERNS);
-String append = 
config.getString(ALWAYS_PARENT_FIRST_LOADER_PATTERNS_ADDITIONAL);
-return parseParentFirstLoaderPatterns(base, append);
+List base =
+ConfigUtils.decodeListFromConfig(
+config, ALWAYS_PARENT_FIRST_LOADER_PATTERNS, 
String::new);
+List append =
+ConfigUtils.decodeListFromConfig(
+config, 
ALWAYS_PARENT_FIRST_LOADER_PATTERNS_ADDITIONAL, String::new);

Review comment:
   Updated

##
File path: 
flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
##
@@ -151,43 +177,50 @@
 @Documentation.ExcludeFromDocumentation(
 "Plugin classloader list is considered an implementation detail. "
 + "Configuration only included in case to mitigate 
unintended side-effects of this young feature.")
-public static final ConfigOption 
PLUGIN_ALWAYS_PARENT_FIRST_LOADER_PATTERNS =
+public static final ConfigOption> 
PLUGIN_ALWAYS_PARENT_FIRST_LOADER_PATTERNS =
 
ConfigOptions.key("plugin.classloader.parent-first-patterns.default")
 .stringType()
-.defaultValue(
-"java.;org.apache.flink.;javax.annotation.;"
-+ PARENT_FIRST_LOGGING_PATTERNS)
+.asList()
+.defaultValues(
+mergeListsToArray(
+Arrays.asList(
+"java.", "org.apache.flink.", 
"javax.annotation."),
+PARENT_FIRST_LOGGING_PATTERNS))
 .withDescription(
-"A (semicolon-separated) list of patterns that 
specifies which classes should always be"
+"A list of patterns that specifies which classes 
should always be"

Review comment:
   Sure, updated the description accordingly.




-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [flink] horacehylee commented on a change in pull request #16821: [FLINK-23358][core] Refactor CoreOptions parent first patterns to List options

2021-10-08 Thread GitBox


horacehylee commented on a change in pull request #16821:
URL: https://github.com/apache/flink/pull/16821#discussion_r725431848



##
File path: 
flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
##
@@ -94,24 +101,39 @@
  * 
  */
 @Documentation.Section(Documentation.Sections.EXPERT_CLASS_LOADING)
-public static final ConfigOption 
ALWAYS_PARENT_FIRST_LOADER_PATTERNS =
+public static final ConfigOption> 
ALWAYS_PARENT_FIRST_LOADER_PATTERNS =
 ConfigOptions.key("classloader.parent-first-patterns.default")
-.defaultValue(
-
"java.;scala.;org.apache.flink.;com.esotericsoftware.kryo;org.apache.hadoop.;javax.annotation.;org.xml;javax.xml;org.apache.xerces;org.w3c;"
-+ PARENT_FIRST_LOGGING_PATTERNS)
+.stringType()
+.asList()
+.defaultValues(
+mergeListsToArray(
+Arrays.asList(
+"java.",
+"scala.",
+"org.apache.flink.",
+"com.esotericsoftware.kryo",
+"org.apache.hadoop.",
+"javax.annotation.",
+"org.xml",
+"javax.xml",
+"org.apache.xerces",
+"org.w3c"),
+PARENT_FIRST_LOGGING_PATTERNS))
 .withDeprecatedKeys("classloader.parent-first-patterns")
 .withDescription(
-"A (semicolon-separated) list of patterns that 
specifies which classes should always be"
+"A 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. This 
setting should generally not be modified. To add another pattern we"
 + " recommend to use 
\"classloader.parent-first-patterns.additional\" instead.");
 
 @Documentation.Section(Documentation.Sections.EXPERT_CLASS_LOADING)
-public static final ConfigOption 
ALWAYS_PARENT_FIRST_LOADER_PATTERNS_ADDITIONAL =
+public static final ConfigOption> 
ALWAYS_PARENT_FIRST_LOADER_PATTERNS_ADDITIONAL =
 ConfigOptions.key("classloader.parent-first-patterns.additional")
-.defaultValue("")
+.stringType()
+.asList()
+.noDefaultValue()

Review comment:
   Good catch. Updated




-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [flink] horacehylee commented on a change in pull request #16821: [FLINK-23358][core] Refactor CoreOptions parent first patterns to List options

2021-10-08 Thread GitBox


horacehylee commented on a change in pull request #16821:
URL: https://github.com/apache/flink/pull/16821#discussion_r725431881



##
File path: 
flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
##
@@ -36,8 +38,13 @@
 public class CoreOptions {
 
 @Internal
-public static final String PARENT_FIRST_LOGGING_PATTERNS =
-
"org.slf4j;org.apache.log4j;org.apache.logging;org.apache.commons.logging;ch.qos.logback";
+public static final List PARENT_FIRST_LOGGING_PATTERNS =
+Arrays.asList(
+"org.slf4j",
+"org.apache.log4j",
+"org.apache.logging",
+"org.apache.commons.logging",
+"ch.qos.logback");

Review comment:
   Yes it will be much nicer with `String[]`

##
File path: 
flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
##
@@ -151,43 +177,50 @@
 @Documentation.ExcludeFromDocumentation(
 "Plugin classloader list is considered an implementation detail. "
 + "Configuration only included in case to mitigate 
unintended side-effects of this young feature.")
-public static final ConfigOption 
PLUGIN_ALWAYS_PARENT_FIRST_LOADER_PATTERNS =
+public static final ConfigOption> 
PLUGIN_ALWAYS_PARENT_FIRST_LOADER_PATTERNS =
 
ConfigOptions.key("plugin.classloader.parent-first-patterns.default")
 .stringType()
-.defaultValue(
-"java.;org.apache.flink.;javax.annotation.;"
-+ PARENT_FIRST_LOGGING_PATTERNS)
+.asList()
+.defaultValues(
+mergeListsToArray(
+Arrays.asList(
+"java.", "org.apache.flink.", 
"javax.annotation."),
+PARENT_FIRST_LOGGING_PATTERNS))
 .withDescription(
-"A (semicolon-separated) list of patterns that 
specifies which classes should always be"
+"A list of patterns that specifies which classes 
should always be"
 + " resolved through the plugin parent 
ClassLoader first. A pattern is a simple prefix that is checked "
 + " against the fully qualified class 
name. This setting should generally not be modified. To add another "
 + " pattern we recommend to use 
\"plugin.classloader.parent-first-patterns.additional\" instead.");
 
 @Documentation.ExcludeFromDocumentation(
 "Plugin classloader list is considered an implementation detail. "
 + "Configuration only included in case to mitigate 
unintended side-effects of this young feature.")
-public static final ConfigOption 
PLUGIN_ALWAYS_PARENT_FIRST_LOADER_PATTERNS_ADDITIONAL =
-
ConfigOptions.key("plugin.classloader.parent-first-patterns.additional")
-.stringType()
-.defaultValue("")
-.withDescription(
-"A (semicolon-separated) list of patterns that 
specifies which classes should always be"
-+ " resolved through the plugin parent 
ClassLoader first. A pattern is a simple prefix that is checked "
-+ " against the fully qualified class 
name. These patterns are appended to \""
-+ 
PLUGIN_ALWAYS_PARENT_FIRST_LOADER_PATTERNS.key()
-+ "\".");
+public static final ConfigOption>
+PLUGIN_ALWAYS_PARENT_FIRST_LOADER_PATTERNS_ADDITIONAL =
+
ConfigOptions.key("plugin.classloader.parent-first-patterns.additional")
+.stringType()
+.asList()
+.noDefaultValue()
+.withDescription(
+"A list of patterns that specifies which 
classes should always be"

Review comment:
   Sure, updated the description accordingly.

##
File path: 
flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
##
@@ -151,43 +177,50 @@
 @Documentation.ExcludeFromDocumentation(
 "Plugin classloader list is considered an implementation detail. "
 + "Configuration only included in case to mitigate 
unintended side-effects of this young feature.")
-public static final ConfigOption 
PLUGIN_ALWAYS_PARENT_FIRST_LOADER_PATTERNS =
+public static final ConfigOption> 
PLUGIN_ALWAYS_PARENT_FIRST_LOADER_PATTERNS =
 
ConfigOptions.key("plugin.classloader.parent-first-patterns.default")
 .stringType()
-