Hisoka-X commented on code in PR #9546:
URL: https://github.com/apache/seatunnel/pull/9546#discussion_r2192516933
##########
seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/main/java/org/apache/seatunnel/core/starter/flink/execution/FlinkAbstractPluginExecuteProcessor.java:
##########
@@ -36,17 +37,34 @@
public abstract class FlinkAbstractPluginExecuteProcessor<T>
implements PluginExecuteProcessor<DataStreamTableInfo,
FlinkRuntimeEnvironment> {
- protected static final BiConsumer<ClassLoader, URL> ADD_URL_TO_CLASSLOADER
=
- (classLoader, url) -> {
+ protected static final BiConsumer<ClassLoader, List<URL>>
ADD_URL_TO_CLASSLOADER =
+ (classLoader, urls) -> {
if
(classLoader.getClass().getName().endsWith("SafetyNetWrapperClassLoader")) {
URLClassLoader c =
(URLClassLoader)
ReflectionUtils.getField(classLoader, "inner").get();
- ReflectionUtils.invoke(c, "addURL", url);
+ urls.forEach(url -> ReflectionUtils.invoke(c, "addURL",
url));
} else if (classLoader instanceof URLClassLoader) {
- ReflectionUtils.invoke(classLoader, "addURL", url);
+ urls.forEach(url -> ReflectionUtils.invoke(classLoader,
"addURL", url));
} else {
- throw new RuntimeException(
- "Unsupported classloader: " +
classLoader.getClass().getName());
+ try {
+ // In Java 8, AppClassLoader is a subclass of
URLClassLoader, so classLoader
+ // instanceof URLClassLoader will return true.
However, in Java 11, due to
+ // the introduction of the modular system,
AppClassLoader is no longer a
+ // subclass of URLClassLoader, and this check will
return false. To be
+ // compatible with both Java 8 and Java 11, we can use
reflection to
+ // dynamically call the addURL method of
URLClassLoader.
+ Optional<Method> method =
+ ReflectionUtils.getDeclaredMethod(
+ URLClassLoader.class, "addURL",
URL.class);
+ if (method.isPresent()) {
+ for (URL url : urls) {
+ method.get().invoke(classLoader, url);
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(
+ "Unsupported classloader: " +
classLoader.getClass().getName());
Review Comment:
```suggestion
throw new RuntimeException(
"Unsupported classloader: " +
classLoader.getClass().getName(), e);
```
##########
seatunnel-plugin-discovery/src/test/resources/duplicate/connectors/plugin-mapping.properties:
##########
@@ -15,20 +15,20 @@
# limitations under the License.
#
-seatunnel.source.HttpBase = connector-http
-seatunnel.sink.HttpBase = connector-http
+seatunnel.source.HttpBase = connector-http-base
+seatunnel.sink.HttpBase = connector-http-base
seatunnel.source.HttpJira = connector-http-jira
seatunnel.sink.HttpJira = connector-http-jira
-seatunnel.source.Kafka = connector-kafka
-seatunnel.sink.Kafka = connector-kafka
+seatunnel.source.Kafka = connector-kafka-base
+seatunnel.sink.Kafka = connector-kafka-base
seatunnel.source.Kafka-Alcs = connector-kafka-alcs
seatunnel.sink.Kafka-Alcs = connector-kafka-alcs
seatunnel.source.Kafka-Blcs = connector-kafka-blcs
seatunnel.sink.Kafka-Blcs = connector-kafka-blcs
seatunnel.source.Jdbc = connector-jdbc
seatunnel.sink.Jdbc = connector-jdbc
-seatunnel.source.Hive1-Jdbc = connector-jdbc-hive1
-seatunnel.sink.Hive1-Jdbc = connector-jdbc-hive1
+seatunnel.source.Hive1-Jdbc = connector-hive1-jdbc
+seatunnel.sink.Hive1-Jdbc = connector-hive1-jdbc
Review Comment:
why change these test case?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]