-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,18 +3,29 @@ | |
import java.util.logging.Logger; | ||
|
||
import org.apache.dubbo.common.Version; | ||
Check failure on line 5 in sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/src/main/java/io/sermant/flowcontrol/FilterExtendTestInterceptor.java
|
||
import org.apache.dubbo.rpc.Invocation; | ||
import org.apache.dubbo.rpc.Invoker; | ||
|
||
import io.sermant.core.common.LoggerFactory; | ||
Check failure on line 9 in sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/src/main/java/io/sermant/flowcontrol/FilterExtendTestInterceptor.java
|
||
import io.sermant.core.plugin.agent.entity.ExecuteContext; | ||
import io.sermant.core.plugin.agent.interceptor.Interceptor; | ||
import io.sermant.flowcontrol.common.config.CommonConst; | ||
|
||
public class FilterExtendTestInterceptor implements Interceptor { | ||
Check failure on line 14 in sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/src/main/java/io/sermant/flowcontrol/FilterExtendTestInterceptor.java
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(); | ||
Check failure on line 15 in sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/src/main/java/io/sermant/flowcontrol/FilterExtendTestInterceptor.java
|
||
|
||
@Override | ||
Check failure on line 17 in sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/src/main/java/io/sermant/flowcontrol/FilterExtendTestInterceptor.java
|
||
public ExecuteContext before(ExecuteContext context) throws Exception { | ||
Object invoke = context.getArguments()[0]; | ||
String currentVersion = invoke.getClass().getPackage().getImplementationVersion(); | ||
Invocation invocation = (Invocation) context.getArguments()[1]; | ||
Check failure on line 19 in sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/src/main/java/io/sermant/flowcontrol/FilterExtendTestInterceptor.java
|
||
Invoker<?> curInvoker = invocation.getInvoker(); | ||
Check failure on line 20 in sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/src/main/java/io/sermant/flowcontrol/FilterExtendTestInterceptor.java
|
||
if (curInvoker == null) { | ||
curInvoker = (Invoker<?>) context.getArguments()[0]; | ||
} | ||
if (isProvider(curInvoker)) { | ||
LOGGER.info("===========================>is provider"); | ||
return context; | ||
} | ||
String currentVersion = curInvoker.getClass().getPackage().getImplementationVersion(); | ||
if (currentVersion == null) { | ||
currentVersion = Version.getVersion(); | ||
} | ||
|
@@ -24,6 +35,11 @@ public ExecuteContext before(ExecuteContext context) throws Exception { | |
return context; | ||
} | ||
|
||
private boolean isProvider(Invoker<?> invoker) { | ||
return !CommonConst.DUBBO_CONSUMER.equals(invoker.getUrl().getParameter(CommonConst.DUBBO_SIDE, | ||
CommonConst.DUBBO_PROVIDER)); | ||
} | ||
|
||
@Override | ||
public ExecuteContext after(ExecuteContext context) throws Exception { | ||
return context; | ||
|