You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by "RocMarshal (via GitHub)" <gi...@apache.org> on 2023/03/19 09:30:35 UTC

[GitHub] [incubator-streampark] RocMarshal opened a new pull request, #2468: [Issue-2458][Refactor] Refactor 'streampark-flink-proxy' module using java language.

RocMarshal opened a new pull request, #2468:
URL: https://github.com/apache/incubator-streampark/pull/2468

   
   
   <!--
   Thank you for contributing to StreamPark! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   ## Contribution Checklist
   
     - If this is your first time, please read our contributor guidelines: [Submit Code](https://streampark.apache.org/community/submit_guide/submit_code).
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-streampark/issues).
   
     - Name the pull request in the form "[Feature] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
   
     - If the PR is unfinished, add `[WIP]` in your PR title, e.g., `[WIP][Feature] Title of the pull request`.
   
   -->
   
   ## What changes were proposed in this pull request
   
   Issue Number: close #2458 
   
   <!--(For example: This pull request proposed to add checkstyle plugin).-->
   
   ## Brief change log
   
    Refactor 'streampark-flink-proxy' module using java language.
   
   ## Verifying this change
   
   - *Manually verified the change by testing locally.* 
   
   ## Does this pull request potentially affect one of the following parts
    - Dependencies (does it add or upgrade a dependency): (yes / **no**)
   


-- 
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-unsubscribe@streampark.apache.org

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


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #2468: [Issue-2458][Refactor] Refactor 'streampark-flink-proxy' module using java language.

Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys commented on code in PR #2468:
URL: https://github.com/apache/incubator-streampark/pull/2468#discussion_r1306461367


##########
streampark-common/src/main/java/org/apache/streampark/common/util/Handler.java:
##########
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.streampark.common.util;
+
+/** A handler with declared exception thrown. */
+public interface Handler<T, R> {

Review Comment:
   We don't need the new Fun interface, Just use java.util.function.Function



##########
streampark-flink/streampark-flink-proxy/src/main/java/org/apache/streampark/flink/proxy/ChildFirstClassLoader.java:
##########
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.streampark.flink.proxy;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Consumer;
+import java.util.regex.Pattern;
+
+/**
+ * A variant of the URLClassLoader that first loads from the URLs and only after that from the
+ * parent.
+ *
+ * <p>{@link #getResourceAsStream(String)} uses {@link #getResource(String)} internally so we don't
+ * override that.
+ */
+public class ChildFirstClassLoader extends URLClassLoader {
+
+  private static final Pattern FLINK_PATTERN =
+      Pattern.compile("flink-(.*).jar", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+
+  private static final String JAR_PROTOCOL = "jar";
+
+  private static final List<String> PARENT_FIRST_PATTERNS =
+      new ArrayList<String>() {

Review Comment:
    It is recommended to use: Arrays.as(...)



-- 
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-unsubscribe@streampark.apache.org

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


[GitHub] [incubator-streampark] RocMarshal commented on pull request #2468: [Issue-2458][Refactor] Refactor 'streampark-flink-proxy' module using java language.

Posted by "RocMarshal (via GitHub)" <gi...@apache.org>.
RocMarshal commented on PR #2468:
URL: https://github.com/apache/incubator-streampark/pull/2468#issuecomment-1549516267

   Hi, @zhoulii  Could you help to review this one ? Thank you ~


-- 
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-unsubscribe@streampark.apache.org

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


[GitHub] [incubator-streampark] RocMarshal commented on a diff in pull request #2468: [Issue-2458][Refactor] Refactor 'streampark-flink-proxy' module using java language.

Posted by "RocMarshal (via GitHub)" <gi...@apache.org>.
RocMarshal commented on code in PR #2468:
URL: https://github.com/apache/incubator-streampark/pull/2468#discussion_r1311481048


##########
streampark-common/src/main/java/org/apache/streampark/common/util/Handler.java:
##########
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.streampark.common.util;
+
+/** A handler with declared exception thrown. */
+public interface Handler<T, R> {

Review Comment:
   Hi, @wolfboys Thx for the comment.
   However, If we use the` java.util.function.Function` without `Exception thrown declaration`, The `Utils.usingAdaptive` will be a lot of `try .... catch ...` clauses, which causes statements noisy.
   
   Of course, I'd like to modify it based on your comments if we could ignored the negative points mentioned above.



-- 
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-unsubscribe@streampark.apache.org

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


[GitHub] [incubator-streampark] RocMarshal closed pull request #2468: [Issue-2458][Refactor] Refactor 'streampark-flink-proxy' module using java language.

Posted by "RocMarshal (via GitHub)" <gi...@apache.org>.
RocMarshal closed pull request #2468: [Issue-2458][Refactor] Refactor 'streampark-flink-proxy' module using java language.
URL: https://github.com/apache/incubator-streampark/pull/2468


-- 
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-unsubscribe@streampark.apache.org

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