pengten commented on code in PR #7443: URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2153495102
########## 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: > Thanks for the suggestion! > > I agree we should encapsulate the annotation check logic, but I suggest handling it directly in the existing `isLocalTCC()` method rather than creating a new one. This approach has several benefits: > > 1. Maintains backward compatibility > 2. Method name still reflects its core purpose > 3. Reduces changes needed in other code > > If we need to add more annotation types in the future, we can simply extend the condition within this method. > > What do you think about this approach? This is one way, but we need to confirm whether this method needs to change its name. -- 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