You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "funky-eyes (via GitHub)" <gi...@apache.org> on 2025/08/04 06:05:36 UTC

[I] The order in AbstractProxyInvocationHandler serves no purpose [incubator-seata]

funky-eyes opened a new issue, #7568:
URL: https://github.com/apache/incubator-seata/issues/7568

   ### Check Ahead
   
   - [x] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.
   
   - [x] I am willing to try to fix this bug myself.
   
   
   ### Ⅰ. Issue Description
   
   https://github.com/apache/incubator-seata/blob/2.x/integration-tx-api/src/main/java/org/apache/seata/integration/tx/api/interceptor/handler/AbstractProxyInvocationHandler.java
   https://github.com/apache/incubator-seata/blob/2.x/integration-tx-api/src/main/java/org/apache/seata/integration/tx/api/interceptor/parser/DefaultInterfaceParser.java#L84
   `Collections.sort(invocationHandlerList, Comparator.comparingInt(ProxyInvocationHandler::order));`
   
   The method order is the one actually used for sorting, not getOrder. Therefore, the order in AbstractProxyInvocationHandler is entirely unnecessary. I suggest setting the value of order in AbstractProxyInvocationHandler to 0 and implementing the order method in the parent class ProxyInvocationHandler. This approach ensures backward compatibility and prevents issues with aspect order inconsistencies when directly implementing the order method in the parent class.
   
   ### Ⅱ. Describe what happened
   
   _No response_
   
   ### Ⅲ. Describe what you expected to happen
   
   _No response_
   
   ### Ⅳ. How to reproduce it (as minimally and precisely as possible)
   
   _No response_
   
   ### Ⅴ. Anything else we need to know?
   
   _No response_
   
   ### Ⅵ. Environment
   
   _No response_


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

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


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


Re: [I] The order in AbstractProxyInvocationHandler serves no purpose [incubator-seata]

Posted by "YongGoose (via GitHub)" <gi...@apache.org>.
YongGoose commented on issue #7568:
URL: https://github.com/apache/incubator-seata/issues/7568#issuecomment-3170466342

   @funky-eyes 
   
   There’s something I’d like to discuss.
   
   With the current implementation(#7570), `getOrder()` and `order()` are set up to return the same number. 
   However, in the case of `TccActionInterceptorHandler`, `getOrder()` returns a value read from the configuration file, while `order()` returns `1`.
   
   - https://github.com/apache/incubator-seata/blob/26d7c15c15bc1e2c3846b55513bd1cb94bf3710d/tcc/src/main/java/org/apache/seata/rm/tcc/interceptor/TccActionInterceptorHandler.java#L206
   
   This means `order()` and `getOrder()` could return different values. 
   What are your thoughts on this?
   


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

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


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


Re: [I] The order in AbstractProxyInvocationHandler serves no purpose [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #7568:
URL: https://github.com/apache/incubator-seata/issues/7568#issuecomment-3149404002

   > [@funky-eyes](https://github.com/funky-eyes)
   > 
   > I’ve noticed that the `setOrder` and `getOrder` methods in `AbstractProxyInvocationHandler` are being used more frequently than expected.
   > 
   > How about making the `order` field function properly instead? If we take this approach, there would be no need to keep its value fixed.
   > 
   > <img alt="Image" width="200" height="200" src="https://private-user-images.githubusercontent.com/104314593/473903903-8b5778af-e326-4feb-a41e-f03f49016a1c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTQyOTA4NTQsIm5iZiI6MTc1NDI5MDU1NCwicGF0aCI6Ii8xMDQzMTQ1OTMvNDczOTAzOTAzLThiNTc3OGFmLWUzMjYtNGZlYi1hNDFlLWYwM2Y0OTAxNmExYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwODA0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDgwNFQwNjU1NTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01ODNmMTU3M2ZhNjY0ZDE2MDE5MTU1YmRmMDNjZDdiNTkzOTAyZjEyZDYyODQyYjk0MTYwM2FlODU1OWI3ZmFiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Kt-4PZiBfxsKiLUJnhBFNwwtp_U234o5fnqPL0vwfoc">
   > If this approach seems too complex, we could setting the value of order in AbstractProxyInvocationHandler to 0 and implementing the order method in the parent class ProxyInvocationHandler. (As you suggested)
   > 
   > P.S. There are many people in South Korea who would like to contribute to Seata!! If this issue is considered a _help-wanted_ type, would it be possible to let community members work on the implementation?
   
   I also hope to make the order variable fully functional. However, the current default value of order is Integer.MAX_VALUE. After reading the code, I noticed that the three current implementations—SagaAnnotationActionInterceptorHandler and TccActionInterceptorHandler—have already overridden the order method. If the third implementation, GlobalTransactionalInterceptorHandler, also overrides the order method and sets the order value to 0, we can then fully enable the order in AbstractProxyInvocationHandler. This approach will not disrupt the existing order and will allow future implementations to take advantage of the order method in AbstractProxyInvocationHandler.
   
   Additionally, I’m thrilled to hear this news, as it demonstrates that the openness and inclusiveness of the Seata community are being recognized by international contributors. Perhaps in the future, the community might even have the chance to host an international meetup, either online or offline—who knows!


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

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


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


Re: [I] The order in AbstractProxyInvocationHandler serves no purpose [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #7568:
URL: https://github.com/apache/incubator-seata/issues/7568#issuecomment-3149591158

   > > Instead of defining order as a default method in ProxyInvocationHandler, we could implement it in AbstractProxyInvocationHandler and set the default value of the order field to 0. What do you think?
   
   I completely agree.


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

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


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


Re: [I] The order in AbstractProxyInvocationHandler serves no purpose [incubator-seata]

Posted by "YongGoose (via GitHub)" <gi...@apache.org>.
YongGoose commented on issue #7568:
URL: https://github.com/apache/incubator-seata/issues/7568#issuecomment-3149449985

   > I also hope to make the order variable fully functional. However, the current default value of order is Integer.MAX_VALUE. After reading the code, I noticed that the three current implementations—SagaAnnotationActionInterceptorHandler and TccActionInterceptorHandler—have already overridden the order method. If the third implementation, GlobalTransactionalInterceptorHandler, also overrides the order method and sets the order value to 0, we can then fully enable the order in AbstractProxyInvocationHandler. This approach will not disrupt the existing order and will allow future implementations to take advantage of the order method in AbstractProxyInvocationHandler.
   > 
   > Additionally, I’m thrilled to hear this news, as it demonstrates that the openness and inclusiveness of the Seata community are being recognized by international contributors. Perhaps in the future, the community might even have the chance to host an international meetup, either online or offline—who knows!
   
   That sounds like a good approach.
   
   In that case, how about overriding the `order` method in `GlobalTransactionalInterceptorHandler` as well, and having the `setOrder` and `getOrder` methods in `SeataInterceptor` set and return the `order` field from `AbstractProxyInvocationHandler`?
   
   Instead of defining `order` as a default method in `ProxyInvocationHandler`, we could implement it in `AbstractProxyInvocationHandler` and set the default value of the `order` field to 0. What do you think?
   
   
   > Additionally, I’m thrilled to hear this news, as it demonstrates that the openness and inclusiveness of the Seata community are being recognized by international contributors. Perhaps in the future, the community might even have the chance to host an international meetup, either online or offline—who knows!
   
   I’m really excited too!
   It would be great if we could give a talk together at an international meetup someday. 🚀
   


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

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


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


Re: [I] The order in AbstractProxyInvocationHandler serves no purpose [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes closed issue #7568: The order in AbstractProxyInvocationHandler serves no purpose
URL: https://github.com/apache/incubator-seata/issues/7568


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

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


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


Re: [I] The order in AbstractProxyInvocationHandler serves no purpose [incubator-seata]

Posted by "YongGoose (via GitHub)" <gi...@apache.org>.
YongGoose commented on issue #7568:
URL: https://github.com/apache/incubator-seata/issues/7568#issuecomment-3149345750

   @funky-eyes 
   
   I’ve noticed that the `setOrder` and `getOrder` methods in `AbstractProxyInvocationHandler` are being used more frequently than expected.
   
   How about making the `order` field function properly instead?
   If we take this approach, there would be no need to keep its value fixed.
   
   <img width="200" height="200" alt="Image" src="https://github.com/user-attachments/assets/8b5778af-e326-4feb-a41e-f03f49016a1c" />
   
   
   If this approach seems too complex, we could simply implement the `order` method in the parent class.
   
   P.S. There are many people in South Korea who would like to contribute to Seata!!
   If this issue is considered a *help-wanted* type, would it be possible to let community members work on the implementation?
   


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

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


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


Re: [I] The order in AbstractProxyInvocationHandler serves no purpose [incubator-seata]

Posted by "keepConcentration (via GitHub)" <gi...@apache.org>.
keepConcentration commented on issue #7568:
URL: https://github.com/apache/incubator-seata/issues/7568#issuecomment-3151033143

   Thank you for assigning me to this issue. :)
   
   I've analyzed the issue and the related code.
   
   Inside `DefaultInterfaceParser.parserInterfaceToProxy`, the `invocationHandlerList` is sorted using the `order()` method of `ProxyInvocationHandler`.
   
   Here’s a brief class hierarchy for context:
   
   `SeataInterceptor`
   └── `ProxyInvocationHandler`
     └── `AbstractProxyInvocationHandler`
       ├── `GlobalTransactionalInterceptorHandler`
       ├── `SagaAnnotationActionInterceptorHandler`
       └── `TccActionInterceptorHandler`
   
   Both `SagaAnnotationActionInterceptorHandler` and `TccActionInterceptorHandler` override the `order()` method appropriately.
   
   However, `GlobalTransactionalInterceptorHandler` does not override `order()`, so it falls back to the implementation in `ProxyInvocationHandler`.
   Even though it defines and uses `getOrder()` / `setOrder()` for managing the `order` field, the `order()` method used during sorting does not take that field into account.
   
   I've implemented the fix based on our previous discussion.
   
   To summarize the proposed solution for this issue:
   - Override the `order()` method in `GlobalTransactionalInterceptorHandler` to return `this.order`.
   - Modify `AbstractProxyInvocationHandler.getOrder()` to return `this.order()`.
   - Set the initial value of the `order` field in `AbstractProxyInvocationHandler` to `0`.
   - Remove the `default` keyword from the `order()` method in `ProxyInvocationHandler`.
   
   I'll submit a pull request with these changes shortly.


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

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


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


Re: [I] The order in AbstractProxyInvocationHandler serves no purpose [incubator-seata]

Posted by "keepConcentration (via GitHub)" <gi...@apache.org>.
keepConcentration commented on issue #7568:
URL: https://github.com/apache/incubator-seata/issues/7568#issuecomment-3149953918

   can you assign this issue to me??


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

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


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