pengten commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2151822628


##########
compatible/src/main/java/io/seata/rm/tcc/remoting/parser/LocalTCCRemotingParser.java:
##########
@@ -63,27 +66,37 @@ public RemotingDesc getServiceDesc(Object bean, String 
beanName) throws Framewor
 
     @Override
     public boolean isService(Class<?> beanClass) throws FrameworkException {
-        return isLocalTCC(beanClass);
+        return isTransactionParticipant(beanClass);
     }
 
     @Override
     public boolean isReference(Object bean, String beanName) {
         return isLocalTCC(bean);
     }
 
+    /**
+     * Determine whether there is an annotation on interface or impl {@link 
LocalTCC} or {@link TransactionParticipant}
+     * @param bean the bean
+     * @return boolean
+     */
     private boolean isLocalTCC(Object bean) {
         Class<?> classType = bean.getClass();
-        return isLocalTCC(classType);
+        return isTransactionParticipant(classType);
     }
 
-
-    private boolean isLocalTCC(Class<?> classType) {
+    /**
+     * Determine whether there is a transaction participant annotation ({@link 
LocalTCC} or {@link TransactionParticipant}) 
+     * on the given class or its interfaces
+     * @param classType the class type to check
+     * @return true if the class has either LocalTCC or TransactionParticipant 
annotation
+     */
+    private boolean isTransactionParticipant(Class<?> classType) {
         Set<Class<?>> interfaceClasses = 
ReflectionUtil.getInterfaces(classType);
         for (Class<?> interClass : interfaceClasses) {
-            if (interClass.isAnnotationPresent(LocalTCC.class)) {
+            if (interClass.isAnnotationPresent(LocalTCC.class) || 
interClass.isAnnotationPresent(TransactionParticipant.class)) {

Review Comment:
   ```
   interClass.isAnnotationPresent(LocalTCC.class) || 
interClass.isAnnotationPresent(TransactionParticipant.class)
   ```
   This condition determines whether it would be more comfortable to 
encapsulate a method separately 🤔
   It seems that this conditional judgment may continue to evolve in the 
future. Now it appears in multiple locations. Perhaps it would be better to 
converge?



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

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


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

Reply via email to