Hongshun Wang created FLINK-35281:
-------------------------------------

             Summary: FlinkEnvironmentUtils#addJar add each jar only once
                 Key: FLINK-35281
                 URL: https://issues.apache.org/jira/browse/FLINK-35281
             Project: Flink
          Issue Type: Bug
          Components: Flink CDC
    Affects Versions: cdc-3.1.0
            Reporter: Hongshun Wang
             Fix For: cdc-3.2.0


Current org.apache.flink.cdc.composer.flink.FlinkEnvironmentUtils#addJar will 
be invoked for each source and sink.
{code:java}

public static void addJar(StreamExecutionEnvironment env, URL jarUrl) {
    try {
        Class<StreamExecutionEnvironment> envClass = 
StreamExecutionEnvironment.class;
        Field field = envClass.getDeclaredField("configuration");
        field.setAccessible(true);
        Configuration configuration = ((Configuration) field.get(env));
        List<String> jars =
                configuration.getOptional(PipelineOptions.JARS).orElse(new 
ArrayList<>());
        jars.add(jarUrl.toString());
        configuration.set(PipelineOptions.JARS, jars);
    } catch (Exception e) {
        throw new RuntimeException("Failed to add JAR to Flink execution 
environment", e);
    } {code}
if multiple source or sink share same jar, the par path will be added repeatly.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to