You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "FoghostCn (via GitHub)" <gi...@apache.org> on 2023/06/15 02:44:44 UTC

[GitHub] [dubbo] FoghostCn opened a new pull request, #12536: add tri native image support

FoghostCn opened a new pull request, #12536:
URL: https://github.com/apache/dubbo/pull/12536

   ## What is the purpose of the change
   
   fix #12535 
   add tri native image support 
   
   every netty channelHandler should have a reflect-config conf in native image build
   as netty does https://github.com/netty/netty/pull/12794, https://github.com/netty/netty/pull/12738
   otherwise will cause io.netty.channel.ChannelHandlerMask#isSkippable check failed
   
   https://github.com/netty/netty/blob/4.1/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java#L177
   
   
   ## Brief changelog
   
   
   ## Verifying this change
   
   
   <!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->
   
   ## Checklist
   - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
   - [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [ ] Add some description to [dubbo-website](https://github.com/apache/dubbo-website) project if you are requesting to add a feature.
   - [ ] GitHub Actions works fine on your own branch.
   - [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] FoghostCn commented on a diff in pull request #12536: add tri native image support

Posted by "FoghostCn (via GitHub)" <gi...@apache.org>.
FoghostCn commented on code in PR #12536:
URL: https://github.com/apache/dubbo/pull/12536#discussion_r1231714670


##########
dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/aot/Netty4ReflectionTypeDescriberRegistrar.java:
##########
@@ -35,16 +39,20 @@ public class Netty4ReflectionTypeDescriberRegistrar implements ReflectionTypeDes
     @Override
     public List<TypeDescriber> getTypeDescribers() {
         List<TypeDescriber> typeDescribers = new ArrayList<>();
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(NettyServerHandler.class));
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(SslServerTlsHandler.class));
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(NettyClientHandler.class));
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(SslClientTlsHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyServerHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(SslServerTlsHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyClientHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(SslClientTlsHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(SelectorProvider.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyPortUnificationServerHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyChannelHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyConnectionHandler.class));
         return typeDescribers;
     }
 
-    private TypeDescriber buildTypeDescriberWithDeclaredMethods(Class<?> c){
+    private TypeDescriber buildTypeDescriberWithPublicMethod(Class<?> cl) {
         Set<MemberCategory> memberCategories = new HashSet<>();
-        memberCategories.add(MemberCategory.INVOKE_DECLARED_METHODS);
-        return new TypeDescriber(c.getName(), null, new HashSet<>(), new HashSet<>(), new HashSet<>(), memberCategories);
+        memberCategories.add(MemberCategory.INVOKE_PUBLIC_METHODS);
+        return new TypeDescriber(cl.getName(), null, new HashSet<>(), new HashSet<>(), new HashSet<>(), memberCategories);

Review Comment:
   cause to method https://github.com/netty/netty/blob/4.1/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java#L167 public is enough and reflect config for ChannelHandler in netty project  is also public, for example:
   
   ```json
     {
       "name": "io.netty.channel.ChannelDuplexHandler",
       "condition": {
         "typeReachable": "io.netty.channel.ChannelDuplexHandler"
       },
       "queryAllPublicMethods": true
     }
   ```



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] CrazyHZM commented on a diff in pull request #12536: add tri native image support

Posted by "CrazyHZM (via GitHub)" <gi...@apache.org>.
CrazyHZM commented on code in PR #12536:
URL: https://github.com/apache/dubbo/pull/12536#discussion_r1230981110


##########
dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/aot/Netty4ReflectionTypeDescriberRegistrar.java:
##########
@@ -35,16 +39,20 @@ public class Netty4ReflectionTypeDescriberRegistrar implements ReflectionTypeDes
     @Override
     public List<TypeDescriber> getTypeDescribers() {
         List<TypeDescriber> typeDescribers = new ArrayList<>();
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(NettyServerHandler.class));
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(SslServerTlsHandler.class));
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(NettyClientHandler.class));
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(SslClientTlsHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyServerHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(SslServerTlsHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyClientHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(SslClientTlsHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(SelectorProvider.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyPortUnificationServerHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyChannelHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyConnectionHandler.class));
         return typeDescribers;
     }
 
-    private TypeDescriber buildTypeDescriberWithDeclaredMethods(Class<?> c){
+    private TypeDescriber buildTypeDescriberWithPublicMethod(Class<?> cl) {
         Set<MemberCategory> memberCategories = new HashSet<>();
-        memberCategories.add(MemberCategory.INVOKE_DECLARED_METHODS);
-        return new TypeDescriber(c.getName(), null, new HashSet<>(), new HashSet<>(), new HashSet<>(), memberCategories);
+        memberCategories.add(MemberCategory.INVOKE_PUBLIC_METHODS);
+        return new TypeDescriber(cl.getName(), null, new HashSet<>(), new HashSet<>(), new HashSet<>(), memberCategories);

Review Comment:
   Why change this member category?



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] FoghostCn commented on a diff in pull request #12536: add tri native image support

Posted by "FoghostCn (via GitHub)" <gi...@apache.org>.
FoghostCn commented on code in PR #12536:
URL: https://github.com/apache/dubbo/pull/12536#discussion_r1231714670


##########
dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/aot/Netty4ReflectionTypeDescriberRegistrar.java:
##########
@@ -35,16 +39,20 @@ public class Netty4ReflectionTypeDescriberRegistrar implements ReflectionTypeDes
     @Override
     public List<TypeDescriber> getTypeDescribers() {
         List<TypeDescriber> typeDescribers = new ArrayList<>();
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(NettyServerHandler.class));
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(SslServerTlsHandler.class));
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(NettyClientHandler.class));
-        typeDescribers.add(buildTypeDescriberWithDeclaredMethods(SslClientTlsHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyServerHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(SslServerTlsHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyClientHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(SslClientTlsHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(SelectorProvider.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyPortUnificationServerHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyChannelHandler.class));
+        typeDescribers.add(buildTypeDescriberWithPublicMethod(NettyConnectionHandler.class));
         return typeDescribers;
     }
 
-    private TypeDescriber buildTypeDescriberWithDeclaredMethods(Class<?> c){
+    private TypeDescriber buildTypeDescriberWithPublicMethod(Class<?> cl) {
         Set<MemberCategory> memberCategories = new HashSet<>();
-        memberCategories.add(MemberCategory.INVOKE_DECLARED_METHODS);
-        return new TypeDescriber(c.getName(), null, new HashSet<>(), new HashSet<>(), new HashSet<>(), memberCategories);
+        memberCategories.add(MemberCategory.INVOKE_PUBLIC_METHODS);
+        return new TypeDescriber(cl.getName(), null, new HashSet<>(), new HashSet<>(), new HashSet<>(), memberCategories);

Review Comment:
   cause to method https://github.com/netty/netty/blob/4.1/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java#L167 public is enough and reflect config in netty project  is also public, for example:
   
   ```json
     {
       "name": "io.netty.channel.ChannelDuplexHandler",
       "condition": {
         "typeReachable": "io.netty.channel.ChannelDuplexHandler"
       },
       "queryAllPublicMethods": true
     }
   ```



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] CrazyHZM merged pull request #12536: add tri native image support

Posted by "CrazyHZM (via GitHub)" <gi...@apache.org>.
CrazyHZM merged PR #12536:
URL: https://github.com/apache/dubbo/pull/12536


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org