public static boolean checkFunctionSwitch(Invoker<?> invoker, Invocation invocation){
        //先动态从调用地址里面获取开关配置信息，这个配置可以在配置中心的动态配置{methodName.}circuit.bread=true/false
        String circuitBreak = invoker.getUrl().getMethodParameter(invocation.getMethodName(),"circuit.break");
        if(StringUtils.isEmpty(circuitBreak)){
            String interfaceName = invoker.getUrl().getParameter(Constants.INTERFACE_KEY);
            String method = invocation.getMethodName();
            StringBuffer interfaceConfig = new StringBuffer(DUBBO_REFERENCE_PREFIX);
            interfaceConfig.append(interfaceName);
            StringBuffer methodConfig = new StringBuffer(interfaceConfig.toString());
            methodConfig.append(".").append(method);
            return getSwitch(interfaceConfig,methodConfig);
        }
        return Boolean.parseBoolean(StringUtils.trim(circuitBreak));
    }
public static boolean checkFunctionSwitch ( Invoker < ? > invoker , Invocation invocation ) { String circuitBreak = invoker . getUrl ( ) . getMethodParameter ( invocation . getMethodName ( ) , "circuit.break" ) ; if ( StringUtils . isEmpty ( circuitBreak ) ) { String interfaceName = invoker . getUrl ( ) . getParameter ( Constants . INTERFACE_KEY ) ; String method = invocation . getMethodName ( ) ; StringBuffer interfaceConfig = new StringBuffer ( DUBBO_REFERENCE_PREFIX ) ; interfaceConfig . append ( interfaceName ) ; StringBuffer methodConfig = new StringBuffer ( interfaceConfig . toString ( ) ) ; methodConfig . append ( "." ) . append ( method ) ; return getSwitch ( interfaceConfig , methodConfig ) ; } return Boolean . parseBoolean ( StringUtils . trim ( circuitBreak ) ) ; }
获取当前调用的服务方法是否开启了服务降级功能
@param invoker
@param invocation
@return