This is an automated email from the ASF dual-hosted git repository.

jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 969c3102e55 Remove composed Interceptor (#22924)
969c3102e55 is described below

commit 969c3102e55dbab31fa661a68b76163b79d96da0
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Dec 16 23:50:02 2022 +0800

    Remove composed Interceptor (#22924)
---
 .../advice/composed/ComposedConstructorAdvice.java | 38 -----------
 .../ComposedInstanceMethodAroundAdvice.java        | 50 ---------------
 .../composed/ComposedStaticMethodAroundAdvice.java | 49 --------------
 .../plugin/interceptor/ConstructorInterceptor.java |  8 ++-
 .../InstanceMethodAroundInterceptor.java           | 15 +++--
 .../interceptor/StaticMethodAroundInterceptor.java | 19 ++++--
 .../composed/ComposedConstructorInterceptor.java   | 34 ----------
 .../ComposedInstanceMethodAroundInterceptor.java   | 34 ----------
 .../ComposedStaticMethodAroundInterceptor.java     | 34 ----------
 .../build/MethodAdvisorBuildEngine.java            |  5 +-
 .../build/builder/MethodAdvisorBuilder.java        | 13 +---
 .../builder/type/ConstructorAdvisorBuilder.java    | 10 +--
 .../builder/type/InstanceMethodAdvisorBuilder.java | 10 +--
 .../builder/type/StaticMethodAdvisorBuilder.java   | 10 +--
 .../ConstructorYamlAdvisorConfigurationTest.java   |  4 +-
 ...ceMethodAroundYamlAdvisorConfigurationTest.java |  3 +-
 ...icMethodAroundYamlAdvisorConfigurationTest.java |  5 +-
 .../advice/ComposedConstructorAdviceTest.java      | 53 ---------------
 .../ComposedStaticMethodAroundAdviceTest.java      | 75 ----------------------
 19 files changed, 47 insertions(+), 422 deletions(-)

diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/advice/composed/ComposedConstructorAdvice.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/advice/composed/ComposedConstructorAdvice.java
deleted file mode 100644
index ad408a991ad..00000000000
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/advice/composed/ComposedConstructorAdvice.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.agent.core.plugin.advice.composed;
-
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.agent.core.plugin.TargetAdviceObject;
-import org.apache.shardingsphere.agent.core.plugin.advice.ConstructorAdvice;
-
-import java.util.Collection;
-
-/**
- * Composed Constructor advice.
- */
-@RequiredArgsConstructor
-public final class ComposedConstructorAdvice implements ConstructorAdvice {
-    
-    private final Collection<ConstructorAdvice> advices;
-    
-    @Override
-    public void onConstructor(final TargetAdviceObject target, final Object[] 
args) {
-        advices.forEach(each -> each.onConstructor(target, args));
-    }
-}
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/advice/composed/ComposedInstanceMethodAroundAdvice.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/advice/composed/ComposedInstanceMethodAroundAdvice.java
deleted file mode 100644
index c97b9bc088d..00000000000
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/advice/composed/ComposedInstanceMethodAroundAdvice.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.agent.core.plugin.advice.composed;
-
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.agent.core.plugin.TargetAdviceObject;
-import 
org.apache.shardingsphere.agent.core.plugin.advice.InstanceMethodAroundAdvice;
-import org.apache.shardingsphere.agent.core.plugin.MethodInvocationResult;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-
-/**
- * Composed instance method around advice.
- */
-@RequiredArgsConstructor
-public final class ComposedInstanceMethodAroundAdvice implements 
InstanceMethodAroundAdvice {
-    
-    private final Collection<InstanceMethodAroundAdvice> advices;
-    
-    @Override
-    public void beforeMethod(final TargetAdviceObject target, final Method 
method, final Object[] args, final MethodInvocationResult result) {
-        advices.forEach(each -> each.beforeMethod(target, method, args, 
result));
-    }
-    
-    @Override
-    public void afterMethod(final TargetAdviceObject target, final Method 
method, final Object[] args, final MethodInvocationResult result) {
-        advices.forEach(each -> each.afterMethod(target, method, args, 
result));
-    }
-    
-    @Override
-    public void onThrowing(final TargetAdviceObject target, final Method 
method, final Object[] args, final Throwable throwable) {
-        advices.forEach(each -> each.onThrowing(target, method, args, 
throwable));
-    }
-}
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/advice/composed/ComposedStaticMethodAroundAdvice.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/advice/composed/ComposedStaticMethodAroundAdvice.java
deleted file mode 100644
index b05bf169510..00000000000
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/advice/composed/ComposedStaticMethodAroundAdvice.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.agent.core.plugin.advice.composed;
-
-import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.agent.core.plugin.advice.StaticMethodAroundAdvice;
-import org.apache.shardingsphere.agent.core.plugin.MethodInvocationResult;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-
-/**
- * Composed class static method around advice.
- */
-@RequiredArgsConstructor
-public final class ComposedStaticMethodAroundAdvice implements 
StaticMethodAroundAdvice {
-    
-    private final Collection<StaticMethodAroundAdvice> advices;
-    
-    @Override
-    public void beforeMethod(final Class<?> clazz, final Method method, final 
Object[] args, final MethodInvocationResult result) {
-        advices.forEach(each -> each.beforeMethod(clazz, method, args, 
result));
-    }
-    
-    @Override
-    public void afterMethod(final Class<?> clazz, final Method method, final 
Object[] args, final MethodInvocationResult result) {
-        advices.forEach(each -> each.afterMethod(clazz, method, args, result));
-    }
-    
-    @Override
-    public void onThrowing(final Class<?> clazz, final Method method, final 
Object[] args, final Throwable throwable) {
-        advices.forEach(each -> each.onThrowing(clazz, method, args, 
throwable));
-    }
-}
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/ConstructorInterceptor.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/ConstructorInterceptor.java
index d7b9cca59c4..e1deb155fc8 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/ConstructorInterceptor.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/ConstructorInterceptor.java
@@ -27,6 +27,8 @@ import 
org.apache.shardingsphere.agent.core.logging.LoggerFactory;
 import org.apache.shardingsphere.agent.core.logging.LoggerFactory.Logger;
 import org.apache.shardingsphere.agent.core.plugin.PluginContext;
 
+import java.util.Collection;
+
 /**
  * Proxy class for ByteBuddy to intercept methods of target and weave 
post-method after constructor.
  */
@@ -35,7 +37,7 @@ public class ConstructorInterceptor {
     
     private static final Logger LOGGER = 
LoggerFactory.getLogger(ConstructorInterceptor.class);
     
-    private final ConstructorAdvice advice;
+    private final Collection<ConstructorAdvice> advices;
     
     /**
      * Intercept constructor.
@@ -48,7 +50,9 @@ public class ConstructorInterceptor {
         boolean adviceEnabled = PluginContext.isPluginEnabled();
         try {
             if (adviceEnabled) {
-                advice.onConstructor(target, args);
+                for (ConstructorAdvice each : advices) {
+                    each.onConstructor(target, args);
+                }
             }
             // CHECKSTYLE:OFF
         } catch (final Throwable throwable) {
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/InstanceMethodAroundInterceptor.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/InstanceMethodAroundInterceptor.java
index 4f6322a2eed..051fcaaafda 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/InstanceMethodAroundInterceptor.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/InstanceMethodAroundInterceptor.java
@@ -31,6 +31,7 @@ import 
org.apache.shardingsphere.agent.core.plugin.TargetAdviceObject;
 import 
org.apache.shardingsphere.agent.core.plugin.advice.InstanceMethodAroundAdvice;
 
 import java.lang.reflect.Method;
+import java.util.Collection;
 import java.util.concurrent.Callable;
 
 /**
@@ -41,7 +42,7 @@ public class InstanceMethodAroundInterceptor {
     
     private static final LoggerFactory.Logger LOGGER = 
LoggerFactory.getLogger(InstanceMethodAroundInterceptor.class);
     
-    private final InstanceMethodAroundAdvice advice;
+    private final Collection<InstanceMethodAroundAdvice> advices;
     
     /**
      * Only intercept instance method.
@@ -60,7 +61,9 @@ public class InstanceMethodAroundInterceptor {
         boolean adviceEnabled = PluginContext.isPluginEnabled();
         try {
             if (adviceEnabled) {
-                advice.beforeMethod(target, method, args, methodResult);
+                for (InstanceMethodAroundAdvice each : advices) {
+                    each.beforeMethod(target, method, args, methodResult);
+                }
             }
             // CHECKSTYLE:OFF
         } catch (final Throwable ex) {
@@ -79,7 +82,9 @@ public class InstanceMethodAroundInterceptor {
             // CHECKSTYLE:ON
             try {
                 if (adviceEnabled) {
-                    advice.onThrowing(target, method, args, ex);
+                    for (InstanceMethodAroundAdvice each : advices) {
+                        each.onThrowing(target, method, args, ex);
+                    }
                 }
                 // CHECKSTYLE:OFF
             } catch (final Throwable ignored) {
@@ -90,7 +95,9 @@ public class InstanceMethodAroundInterceptor {
         } finally {
             try {
                 if (adviceEnabled) {
-                    advice.afterMethod(target, method, args, methodResult);
+                    for (InstanceMethodAroundAdvice each : advices) {
+                        each.afterMethod(target, method, args, methodResult);
+                    }
                 }
                 // CHECKSTYLE:OFF
             } catch (final Throwable ex) {
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/StaticMethodAroundInterceptor.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/StaticMethodAroundInterceptor.java
index 7f247692fcf..a6d39e3ec2e 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/StaticMethodAroundInterceptor.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/StaticMethodAroundInterceptor.java
@@ -23,12 +23,13 @@ import 
net.bytebuddy.implementation.bind.annotation.AllArguments;
 import net.bytebuddy.implementation.bind.annotation.Origin;
 import net.bytebuddy.implementation.bind.annotation.RuntimeType;
 import net.bytebuddy.implementation.bind.annotation.SuperCall;
-import 
org.apache.shardingsphere.agent.core.plugin.advice.StaticMethodAroundAdvice;
-import org.apache.shardingsphere.agent.core.plugin.MethodInvocationResult;
 import org.apache.shardingsphere.agent.core.logging.LoggerFactory;
+import org.apache.shardingsphere.agent.core.plugin.MethodInvocationResult;
 import org.apache.shardingsphere.agent.core.plugin.PluginContext;
+import 
org.apache.shardingsphere.agent.core.plugin.advice.StaticMethodAroundAdvice;
 
 import java.lang.reflect.Method;
+import java.util.Collection;
 import java.util.concurrent.Callable;
 
 /**
@@ -39,7 +40,7 @@ public class StaticMethodAroundInterceptor {
     
     private static final LoggerFactory.Logger LOGGER = 
LoggerFactory.getLogger(StaticMethodAroundInterceptor.class);
     
-    private final StaticMethodAroundAdvice advice;
+    private final Collection<StaticMethodAroundAdvice> advices;
     
     /**
      * Only intercept static method.
@@ -58,7 +59,9 @@ public class StaticMethodAroundInterceptor {
         boolean adviceEnabled = PluginContext.isPluginEnabled();
         try {
             if (adviceEnabled) {
-                advice.beforeMethod(klass, method, args, methodResult);
+                for (StaticMethodAroundAdvice each : advices) {
+                    each.beforeMethod(klass, method, args, methodResult);
+                }
             }
             // CHECKSTYLE:OFF
         } catch (final Throwable ex) {
@@ -77,7 +80,9 @@ public class StaticMethodAroundInterceptor {
             // CHECKSTYLE:ON
             try {
                 if (adviceEnabled) {
-                    advice.onThrowing(klass, method, args, ex);
+                    for (StaticMethodAroundAdvice each : advices) {
+                        each.onThrowing(klass, method, args, ex);
+                    }
                 }
                 // CHECKSTYLE:OFF
             } catch (final Throwable ignored) {
@@ -88,7 +93,9 @@ public class StaticMethodAroundInterceptor {
         } finally {
             try {
                 if (adviceEnabled) {
-                    advice.afterMethod(klass, method, args, methodResult);
+                    for (StaticMethodAroundAdvice each : advices) {
+                        each.afterMethod(klass, method, args, methodResult);
+                    }
                 }
                 // CHECKSTYLE:OFF
             } catch (final Throwable ex) {
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/composed/ComposedConstructorInterceptor.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/composed/ComposedConstructorInterceptor.java
deleted file mode 100644
index 178fb5565d1..00000000000
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/composed/ComposedConstructorInterceptor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.agent.core.plugin.interceptor.composed;
-
-import org.apache.shardingsphere.agent.core.plugin.advice.ConstructorAdvice;
-import 
org.apache.shardingsphere.agent.core.plugin.advice.composed.ComposedConstructorAdvice;
-import 
org.apache.shardingsphere.agent.core.plugin.interceptor.ConstructorInterceptor;
-
-import java.util.Collection;
-
-/**
- * Composed constructor interceptor.
- */
-public final class ComposedConstructorInterceptor extends 
ConstructorInterceptor {
-    
-    public ComposedConstructorInterceptor(final Collection<ConstructorAdvice> 
constructorAdvices) {
-        super(new ComposedConstructorAdvice(constructorAdvices));
-    }
-}
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/composed/ComposedInstanceMethodAroundInterceptor.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/composed/ComposedInstanceMethodAroundInterceptor.java
deleted file mode 100644
index ea0b317ca48..00000000000
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/composed/ComposedInstanceMethodAroundInterceptor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.agent.core.plugin.interceptor.composed;
-
-import 
org.apache.shardingsphere.agent.core.plugin.advice.InstanceMethodAroundAdvice;
-import 
org.apache.shardingsphere.agent.core.plugin.advice.composed.ComposedInstanceMethodAroundAdvice;
-import 
org.apache.shardingsphere.agent.core.plugin.interceptor.InstanceMethodAroundInterceptor;
-
-import java.util.Collection;
-
-/**
- * Composed instance method around interceptor.
- */
-public final class ComposedInstanceMethodAroundInterceptor extends 
InstanceMethodAroundInterceptor {
-    
-    public ComposedInstanceMethodAroundInterceptor(final 
Collection<InstanceMethodAroundAdvice> instanceMethodAroundAdvices) {
-        super(new 
ComposedInstanceMethodAroundAdvice(instanceMethodAroundAdvices));
-    }
-}
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/composed/ComposedStaticMethodAroundInterceptor.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/composed/ComposedStaticMethodAroundInterceptor.java
deleted file mode 100644
index b3bc2dcd3bf..00000000000
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/interceptor/composed/ComposedStaticMethodAroundInterceptor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.agent.core.plugin.interceptor.composed;
-
-import 
org.apache.shardingsphere.agent.core.plugin.advice.StaticMethodAroundAdvice;
-import 
org.apache.shardingsphere.agent.core.plugin.advice.composed.ComposedStaticMethodAroundAdvice;
-import 
org.apache.shardingsphere.agent.core.plugin.interceptor.StaticMethodAroundInterceptor;
-
-import java.util.Collection;
-
-/**
- * Composed static method around interceptor.
- */
-public final class ComposedStaticMethodAroundInterceptor extends 
StaticMethodAroundInterceptor {
-    
-    public ComposedStaticMethodAroundInterceptor(final 
Collection<StaticMethodAroundAdvice> instanceMethodAroundAdvices) {
-        super(new 
ComposedStaticMethodAroundAdvice(instanceMethodAroundAdvices));
-    }
-}
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/MethodAdvisorBuildEngine.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/MethodAdvisorBuildEngine.java
index bd88063c269..f623e080e5d 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/MethodAdvisorBuildEngine.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/MethodAdvisorBuildEngine.java
@@ -71,9 +71,6 @@ public final class MethodAdvisorBuildEngine {
         if (matchedAdvisorConfigs.isEmpty()) {
             return null;
         }
-        if (1 == matchedAdvisorConfigs.size()) {
-            return 
methodAdvisorBuilder.getSingleMethodAdvisor(methodDescription, 
matchedAdvisorConfigs.get(0));
-        }
-        return 
methodAdvisorBuilder.getComposedMethodAdvisor(methodDescription, 
matchedAdvisorConfigs);
+        return methodAdvisorBuilder.getMethodAdvisor(methodDescription, 
matchedAdvisorConfigs);
     }
 }
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/MethodAdvisorBuilder.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/MethodAdvisorBuilder.java
index d232e61ccaa..8fe3aabc829 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/MethodAdvisorBuilder.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/MethodAdvisorBuilder.java
@@ -47,20 +47,11 @@ public interface MethodAdvisorBuilder {
     boolean isMatchedMethod(InDefinedShape methodDescription);
     
     /**
-     * Get single method advisor.
-     * 
-     * @param methodDescription method description
-     * @param advisorConfig advisor configuration
-     * @return got method advisor
-     */
-    MethodAdvisor getSingleMethodAdvisor(InDefinedShape methodDescription, 
MethodAdvisorConfiguration advisorConfig);
-    
-    /**
-     * Get composed method advisor.
+     * Get method advisor.
      * 
      * @param methodDescription method description
      * @param advisorConfigs advisor configurations
      * @return got method advisor
      */
-    MethodAdvisor getComposedMethodAdvisor(InDefinedShape methodDescription, 
List<MethodAdvisorConfiguration> advisorConfigs);
+    MethodAdvisor getMethodAdvisor(InDefinedShape methodDescription, 
List<MethodAdvisorConfiguration> advisorConfigs);
 }
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/ConstructorAdvisorBuilder.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/ConstructorAdvisorBuilder.java
index 5dcf46f4c26..bcb283ac44f 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/ConstructorAdvisorBuilder.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/ConstructorAdvisorBuilder.java
@@ -26,7 +26,6 @@ import net.bytebuddy.matcher.ElementMatchers;
 import 
org.apache.shardingsphere.agent.config.advisor.MethodAdvisorConfiguration;
 import org.apache.shardingsphere.agent.core.plugin.advice.ConstructorAdvice;
 import 
org.apache.shardingsphere.agent.core.plugin.interceptor.ConstructorInterceptor;
-import 
org.apache.shardingsphere.agent.core.plugin.interceptor.composed.ComposedConstructorInterceptor;
 import org.apache.shardingsphere.agent.core.transformer.MethodAdvisor;
 import 
org.apache.shardingsphere.agent.core.transformer.build.advise.AdviceFactory;
 import 
org.apache.shardingsphere.agent.core.transformer.build.builder.MethodAdvisorBuilder;
@@ -55,14 +54,9 @@ public final class ConstructorAdvisorBuilder implements 
MethodAdvisorBuilder {
     }
     
     @Override
-    public MethodAdvisor getSingleMethodAdvisor(final InDefinedShape 
methodDescription, final MethodAdvisorConfiguration advisorConfig) {
-        return new MethodAdvisor(methodDescription, new 
ConstructorInterceptor(adviceFactory.getAdvice(advisorConfig.getAdviceClassName())));
-    }
-    
-    @Override
-    public MethodAdvisor getComposedMethodAdvisor(final InDefinedShape 
methodDescription, final List<MethodAdvisorConfiguration> advisorConfigs) {
+    public MethodAdvisor getMethodAdvisor(final InDefinedShape 
methodDescription, final List<MethodAdvisorConfiguration> advisorConfigs) {
         Collection<ConstructorAdvice> advices = advisorConfigs
                 
.stream().map(MethodAdvisorConfiguration::getAdviceClassName).map(each -> 
(ConstructorAdvice) adviceFactory.getAdvice(each)).collect(Collectors.toList());
-        return new MethodAdvisor(methodDescription, new 
ComposedConstructorInterceptor(advices));
+        return new MethodAdvisor(methodDescription, new 
ConstructorInterceptor(advices));
     }
 }
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/InstanceMethodAdvisorBuilder.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/InstanceMethodAdvisorBuilder.java
index d2b06d453cc..70dc1cb8250 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/InstanceMethodAdvisorBuilder.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/InstanceMethodAdvisorBuilder.java
@@ -25,7 +25,6 @@ import net.bytebuddy.matcher.ElementMatchers;
 import 
org.apache.shardingsphere.agent.config.advisor.MethodAdvisorConfiguration;
 import 
org.apache.shardingsphere.agent.core.plugin.advice.InstanceMethodAroundAdvice;
 import 
org.apache.shardingsphere.agent.core.plugin.interceptor.InstanceMethodAroundInterceptor;
-import 
org.apache.shardingsphere.agent.core.plugin.interceptor.composed.ComposedInstanceMethodAroundInterceptor;
 import org.apache.shardingsphere.agent.core.transformer.MethodAdvisor;
 import 
org.apache.shardingsphere.agent.core.transformer.build.advise.AdviceFactory;
 import 
org.apache.shardingsphere.agent.core.transformer.build.builder.MethodAdvisorBuilder;
@@ -53,14 +52,9 @@ public final class InstanceMethodAdvisorBuilder implements 
MethodAdvisorBuilder
     }
     
     @Override
-    public MethodAdvisor getSingleMethodAdvisor(final InDefinedShape 
methodDescription, final MethodAdvisorConfiguration advisorConfig) {
-        return new MethodAdvisor(methodDescription, new 
InstanceMethodAroundInterceptor(adviceFactory.getAdvice(advisorConfig.getAdviceClassName())));
-    }
-    
-    @Override
-    public MethodAdvisor getComposedMethodAdvisor(final InDefinedShape 
methodDescription, final List<MethodAdvisorConfiguration> advisorConfigs) {
+    public MethodAdvisor getMethodAdvisor(final InDefinedShape 
methodDescription, final List<MethodAdvisorConfiguration> advisorConfigs) {
         Collection<InstanceMethodAroundAdvice> advices = advisorConfigs
                 .stream().<InstanceMethodAroundAdvice>map(each -> 
adviceFactory.getAdvice(each.getAdviceClassName())).collect(Collectors.toList());
-        return new MethodAdvisor(methodDescription, new 
ComposedInstanceMethodAroundInterceptor(advices));
+        return new MethodAdvisor(methodDescription, new 
InstanceMethodAroundInterceptor(advices));
     }
 }
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/StaticMethodAdvisorBuilder.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/StaticMethodAdvisorBuilder.java
index 37df7586cea..8a57e43e5d7 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/StaticMethodAdvisorBuilder.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/transformer/build/builder/type/StaticMethodAdvisorBuilder.java
@@ -25,7 +25,6 @@ import net.bytebuddy.matcher.ElementMatchers;
 import 
org.apache.shardingsphere.agent.config.advisor.MethodAdvisorConfiguration;
 import 
org.apache.shardingsphere.agent.core.plugin.advice.StaticMethodAroundAdvice;
 import 
org.apache.shardingsphere.agent.core.plugin.interceptor.StaticMethodAroundInterceptor;
-import 
org.apache.shardingsphere.agent.core.plugin.interceptor.composed.ComposedStaticMethodAroundInterceptor;
 import org.apache.shardingsphere.agent.core.transformer.MethodAdvisor;
 import 
org.apache.shardingsphere.agent.core.transformer.build.advise.AdviceFactory;
 import 
org.apache.shardingsphere.agent.core.transformer.build.builder.MethodAdvisorBuilder;
@@ -53,13 +52,8 @@ public final class StaticMethodAdvisorBuilder implements 
MethodAdvisorBuilder {
     }
     
     @Override
-    public MethodAdvisor getSingleMethodAdvisor(final InDefinedShape 
methodDescription, final MethodAdvisorConfiguration advisorConfig) {
-        return new MethodAdvisor(methodDescription, new 
StaticMethodAroundInterceptor(adviceFactory.getAdvice(advisorConfig.getAdviceClassName())));
-    }
-    
-    @Override
-    public MethodAdvisor getComposedMethodAdvisor(final InDefinedShape 
methodDescription, final List<MethodAdvisorConfiguration> advisorConfigs) {
+    public MethodAdvisor getMethodAdvisor(final InDefinedShape 
methodDescription, final List<MethodAdvisorConfiguration> advisorConfigs) {
         Collection<StaticMethodAroundAdvice> advices = 
advisorConfigs.stream().<StaticMethodAroundAdvice>map(each -> 
adviceFactory.getAdvice(each.getAdviceClassName())).collect(Collectors.toList());
-        return new MethodAdvisor(methodDescription, new 
ComposedStaticMethodAroundInterceptor(advices));
+        return new MethodAdvisor(methodDescription, new 
StaticMethodAroundInterceptor(advices));
     }
 }
diff --git 
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/ConstructorYamlAdvisorConfigurationTest.java
 
b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/ConstructorYamlAdvisorConfigurationTest.java
index 7cb42d72ada..73466a78ea8 100644
--- 
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/ConstructorYamlAdvisorConfigurationTest.java
+++ 
b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/ConstructorYamlAdvisorConfigurationTest.java
@@ -36,6 +36,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -68,7 +69,8 @@ public final class ConstructorYamlAdvisorConfigurationTest {
                                 .implement(TargetAdviceObject.class)
                                 .intercept(FieldAccessor.ofField(EXTRA_DATA))
                                 .constructor(ElementMatchers.isConstructor())
-                                
.intercept(SuperMethodCall.INSTANCE.andThen(MethodDelegation.withDefaultConfiguration().to(new
 ConstructorInterceptor(new MockConstructorAdvice(QUEUE)))));
+                                
.intercept(SuperMethodCall.INSTANCE.andThen(MethodDelegation.withDefaultConfiguration()
+                                        .to(new 
ConstructorInterceptor(Collections.singleton(new 
MockConstructorAdvice(QUEUE))))));
                     }
                     return builder;
                 })
diff --git 
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/InstanceMethodAroundYamlAdvisorConfigurationTest.java
 
b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/InstanceMethodAroundYamlAdvisorConfigurationTest.java
index ece107956b5..11d43c31803 100644
--- 
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/InstanceMethodAroundYamlAdvisorConfigurationTest.java
+++ 
b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/InstanceMethodAroundYamlAdvisorConfigurationTest.java
@@ -40,6 +40,7 @@ import org.junit.runners.Parameterized.Parameters;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -95,7 +96,7 @@ public final class 
InstanceMethodAroundYamlAdvisorConfigurationTest {
         InstanceMaterial material = new ByteBuddy()
                 .subclass(InstanceMaterial.class)
                 .method(ElementMatchers.named(methodName))
-                .intercept(MethodDelegation.withDefaultConfiguration().to(new 
InstanceMethodAroundInterceptor(new MockInstanceMethodAroundAdvice(rebase))))
+                .intercept(MethodDelegation.withDefaultConfiguration().to(new 
InstanceMethodAroundInterceptor(Collections.singleton(new 
MockInstanceMethodAroundAdvice(rebase)))))
                 .make()
                 .load(new MockClassLoader())
                 .getLoaded()
diff --git 
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/StaticMethodAroundYamlAdvisorConfigurationTest.java
 
b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/StaticMethodAroundYamlAdvisorConfigurationTest.java
index 00967b270e9..811dc959f39 100644
--- 
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/StaticMethodAroundYamlAdvisorConfigurationTest.java
+++ 
b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/interceptor/StaticMethodAroundYamlAdvisorConfigurationTest.java
@@ -40,6 +40,7 @@ import org.junit.runners.Parameterized.Parameters;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -82,9 +83,9 @@ public final class 
StaticMethodAroundYamlAdvisorConfigurationTest {
                                 .implement(TargetAdviceObject.class)
                                 .intercept(FieldAccessor.ofField(EXTRA_DATA))
                                 
.method(ElementMatchers.named("staticMockWithException"))
-                                
.intercept(MethodDelegation.withDefaultConfiguration().to(new 
StaticMethodAroundInterceptor(new MockStaticMethodAroundAdvice(false))))
+                                
.intercept(MethodDelegation.withDefaultConfiguration().to(new 
StaticMethodAroundInterceptor(Collections.singleton(new 
MockStaticMethodAroundAdvice(false)))))
                                 .method(ElementMatchers.named("staticMock"))
-                                
.intercept(MethodDelegation.withDefaultConfiguration().to(new 
StaticMethodAroundInterceptor(new MockStaticMethodAroundAdvice(true))));
+                                
.intercept(MethodDelegation.withDefaultConfiguration().to(new 
StaticMethodAroundInterceptor(Collections.singleton(new 
MockStaticMethodAroundAdvice(true)))));
                     }
                     return builder;
                 })
diff --git 
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/transformer/advice/ComposedConstructorAdviceTest.java
 
b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/transformer/advice/ComposedConstructorAdviceTest.java
deleted file mode 100644
index 4f9adde70e5..00000000000
--- 
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/transformer/advice/ComposedConstructorAdviceTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.agent.core.transformer.advice;
-
-import org.apache.shardingsphere.agent.core.plugin.TargetAdviceObject;
-import org.apache.shardingsphere.agent.core.plugin.advice.ConstructorAdvice;
-import org.apache.shardingsphere.agent.core.mock.advice.MockConstructorAdvice;
-import 
org.apache.shardingsphere.agent.core.plugin.advice.composed.ComposedConstructorAdvice;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import java.util.Collections;
-import java.util.LinkedList;
-
-import static org.mockito.Mockito.mock;
-
-@RunWith(MockitoJUnitRunner.class)
-public final class ComposedConstructorAdviceTest {
-    
-    private final ConstructorAdvice constructorAdvice = new 
MockConstructorAdvice();
-    
-    private ComposedConstructorAdvice actual;
-    
-    @Before
-    public void setUp() {
-        actual = new 
ComposedConstructorAdvice(Collections.singleton(constructorAdvice));
-    }
-    
-    @Test
-    public void assertOnConstructor() {
-        TargetAdviceObject targetAdviceObject = mock(TargetAdviceObject.class);
-        Object[] args = new Object[2];
-        args[0] = new LinkedList<String>();
-        actual.onConstructor(targetAdviceObject, args);
-    }
-}
diff --git 
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/transformer/advice/ComposedStaticMethodAroundAdviceTest.java
 
b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/transformer/advice/ComposedStaticMethodAroundAdviceTest.java
deleted file mode 100644
index d1702c3b7ed..00000000000
--- 
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/transformer/advice/ComposedStaticMethodAroundAdviceTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.agent.core.transformer.advice;
-
-import 
org.apache.shardingsphere.agent.core.plugin.advice.StaticMethodAroundAdvice;
-import org.apache.shardingsphere.agent.core.plugin.MethodInvocationResult;
-import 
org.apache.shardingsphere.agent.core.plugin.advice.composed.ComposedStaticMethodAroundAdvice;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-@RunWith(MockitoJUnitRunner.class)
-public final class ComposedStaticMethodAroundAdviceTest {
-    
-    @Mock
-    private StaticMethodAroundAdvice staticMethodAroundAdvice;
-    
-    private ComposedStaticMethodAroundAdvice actual;
-    
-    @Before
-    public void setUp() {
-        actual = new ComposedStaticMethodAroundAdvice(new 
ArrayList<>(Collections.singleton(staticMethodAroundAdvice)));
-    }
-    
-    @Test
-    public void assertBeforeMethod() {
-        Method method = mock(Method.class);
-        Object[] args = new Object[2];
-        MethodInvocationResult methodInvocationResult = 
mock(MethodInvocationResult.class);
-        actual.beforeMethod(String.class, method, args, 
methodInvocationResult);
-        verify(staticMethodAroundAdvice).beforeMethod(String.class, method, 
args, methodInvocationResult);
-    }
-    
-    @Test
-    public void assertAfterMethod() {
-        Method method = mock(Method.class);
-        Object[] args = new Object[2];
-        MethodInvocationResult methodInvocationResult = 
mock(MethodInvocationResult.class);
-        actual.afterMethod(String.class, method, args, methodInvocationResult);
-        verify(staticMethodAroundAdvice).afterMethod(String.class, method, 
args, methodInvocationResult);
-    }
-    
-    @Test
-    public void assertOnThrowing() {
-        Method method = mock(Method.class);
-        Object[] args = new Object[2];
-        NullPointerException exception = new NullPointerException("");
-        actual.onThrowing(String.class, method, args, exception);
-        verify(staticMethodAroundAdvice).onThrowing(String.class, method, 
args, exception);
-    }
-}


Reply via email to