funky-eyes commented on code in PR #6331:
URL: https://github.com/apache/incubator-seata/pull/6331#discussion_r1505466963


##########
integration-tx-api/src/main/java/org/apache/seata/integration/tx/api/interceptor/handler/GlobalTransactionalInterceptorHandler.java:
##########
@@ -410,4 +410,9 @@ public SeataInterceptorPosition getPosition() {
         return SeataInterceptorPosition.BeforeTransaction;
     }
 
+
+    @Override
+    public String type() {
+        return "GlobalTransactional";

Review Comment:
   Is this more appropriately defined as an enumeration?



##########
integration-tx-api/src/main/java/org/apache/seata/integration/tx/api/interceptor/parser/DefaultInterfaceParser.java:
##########
@@ -53,15 +57,46 @@ protected void initInterfaceParser() {
         }
     }
 
+    /**
+     * Create an interceptor chain that supports adding multiple 
interceptors.Create an interceptor chain that supports adding multiple 
interceptors.
+     * The entry order of the facets can be specified through {@link 
ProxyInvocationHandler # order()}.
+     * It is not allowed to load multiple interceptors of the same type, such 
as two-stage annotations for TCC and Saga that cannot exist simultaneously. The 
type can be specified through {@link ProxyInvocationHandler # type()}.It is not 
allowed to load multiple interceptors of the same type, such as two-stage 
annotations for TCC and Saga that cannot exist simultaneously. The type can be 
specified through {@link ProxyInvocationHandler # type()}.
+     *
+     * @param target
+     * @param objectName
+     * @return
+     * @throws Exception
+     */
     @Override
     public ProxyInvocationHandler parserInterfaceToProxy(Object target, String 
objectName) throws Exception {
+        List<ProxyInvocationHandler> invocationHandlerList = new ArrayList<>();
+        Set<String> invocationHandlerRepeatCheck = new HashSet<>();
+
         for (InterfaceParser interfaceParser : ALL_INTERFACE_PARSERS) {
             ProxyInvocationHandler proxyInvocationHandler = 
interfaceParser.parserInterfaceToProxy(target, objectName);
             if (proxyInvocationHandler != null) {
-                return proxyInvocationHandler;
+                if 
(!invocationHandlerRepeatCheck.add(proxyInvocationHandler.type())) {
+                    throw new RuntimeException("there is already an annotation 
of type " + proxyInvocationHandler.type() + " for class: " + 
target.getClass().getName());
+                }
+                invocationHandlerList.add(proxyInvocationHandler);
             }
         }
-        return null;
+
+        Collections.sort(invocationHandlerList, 
Comparator.comparingInt(ProxyInvocationHandler::order));
+
+        ProxyInvocationHandler result = null;

Review Comment:
   Although he is a result, should he be named first?
   虽然他是一个result,是否应该命名为first?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to