org.apache.dubbo.common.Version.isRelease270OrHigher()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.apache.dubbo.common.Version.isRelease270OrHigher()方法的一些代码示例,展示了Version.isRelease270OrHigher()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.isRelease270OrHigher()方法的具体详情如下:
包路径:org.apache.dubbo.common.Version
类名称:Version
方法名:isRelease270OrHigher

Version.isRelease270OrHigher介绍

[英]Check the framework release version number to decide if it's 2.7.0 or higher
[中]检查框架发布版本号以确定它是2.7.0还是更高版本

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
  public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
    RemoteInvocation invocation;
    /*
     package was renamed to 'org.apache.dubbo' in v2.7.0, so only provider versions after v2.7.0 can
     recognize org.apache.xxx.HttpRemoteInvocation'.
     */
    if (Version.isRelease270OrHigher(url.getParameter(Constants.RELEASE_KEY))) {
      invocation = new HttpRemoteInvocation(methodInvocation);
    } else {
      /*
       The customized 'com.alibaba.dubbo.rpc.protocol.http.HttpRemoteInvocation' was firstly introduced
       in v2.6.3. The main purpose is to support transformation of attachments in HttpProtocol, see
       https://github.com/apache/incubator-dubbo/pull/1827. To guarantee interoperability with lower
       versions, we need to check if the provider is v2.6.3 or higher before sending customized
       HttpRemoteInvocation.
       */
      if (Version.isRelease263OrHigher(url.getParameter(Constants.DUBBO_VERSION_KEY))) {
        invocation = new com.alibaba.dubbo.rpc.protocol.http.HttpRemoteInvocation(methodInvocation);
      } else {
        invocation = new RemoteInvocation(methodInvocation);
      }
    }
    if (isGeneric) {
      invocation.addAttribute(Constants.GENERIC_KEY, generic);
    }
    return invocation;
  }
});

代码示例来源:origin: apache/incubator-dubbo

@Override
  public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
    RemoteInvocation invocation;
    /*
     package was renamed to 'org.apache.dubbo' in v2.7.0, so only provider versions after v2.7.0 can
     recognize org.apache.xxx.HttpRemoteInvocation'.
     */
    if (Version.isRelease270OrHigher(url.getParameter(Constants.RELEASE_KEY))) {
      invocation = new HttpRemoteInvocation(methodInvocation);
    } else {
      /*
       The customized 'com.alibaba.dubbo.rpc.protocol.http.HttpRemoteInvocation' was firstly introduced
       in v2.6.3. The main purpose is to support transformation of attachments in HttpProtocol, see
       https://github.com/apache/incubator-dubbo/pull/1827. To guarantee interoperability with lower
       versions, we need to check if the provider is v2.6.3 or higher before sending customized
       HttpRemoteInvocation.
       */
      if (Version.isRelease263OrHigher(url.getParameter(Constants.DUBBO_VERSION_KEY))) {
        invocation = new com.alibaba.dubbo.rpc.protocol.http.HttpRemoteInvocation(methodInvocation);
      } else {
        invocation = new RemoteInvocation(methodInvocation);
      }
    }
    if (isGeneric) {
      invocation.addAttribute(Constants.GENERIC_KEY, generic);
    }
    return invocation;
  }
});

代码示例来源:origin: apache/incubator-dubbo

@Override
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
  final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
  /*
   RMI needs extra parameter since it uses customized remote invocation object
   The customized RemoteInvocation was firstly introduced in v2.6.3; The package was renamed to 'org.apache.*' since v2.7.0
   Considering the above two conditions, we need to check before sending customized RemoteInvocation:
   1. if the provider version is v2.7.0 or higher, send 'org.apache.dubbo.rpc.protocol.rmi.RmiRemoteInvocation'.
   2. if the provider version is v2.6.3 or higher, send 'com.alibaba.dubbo.rpc.protocol.rmi.RmiRemoteInvocation'.
   3. if the provider version is lower than v2.6.3, does not use customized RemoteInvocation.
   */
  if (isRelease270OrHigher(url.getParameter(Constants.RELEASE_KEY))) {
    rmiProxyFactoryBean.setRemoteInvocationFactory(RmiRemoteInvocation::new);
  } else if (isRelease263OrHigher(url.getParameter(Constants.DUBBO_VERSION_KEY))) {
    rmiProxyFactoryBean.setRemoteInvocationFactory(com.alibaba.dubbo.rpc.protocol.rmi.RmiRemoteInvocation::new);
  }
  rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
  rmiProxyFactoryBean.setServiceInterface(serviceType);
  rmiProxyFactoryBean.setCacheStub(true);
  rmiProxyFactoryBean.setLookupStubOnStartup(true);
  rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
  rmiProxyFactoryBean.afterPropertiesSet();
  return (T) rmiProxyFactoryBean.getObject();
}

代码示例来源:origin: apache/incubator-dubbo

@Override
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
  final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
  /*
   RMI needs extra parameter since it uses customized remote invocation object
   The customized RemoteInvocation was firstly introduced in v2.6.3; The package was renamed to 'org.apache.*' since v2.7.0
   Considering the above two conditions, we need to check before sending customized RemoteInvocation:
   1. if the provider version is v2.7.0 or higher, send 'org.apache.dubbo.rpc.protocol.rmi.RmiRemoteInvocation'.
   2. if the provider version is v2.6.3 or higher, send 'com.alibaba.dubbo.rpc.protocol.rmi.RmiRemoteInvocation'.
   3. if the provider version is lower than v2.6.3, does not use customized RemoteInvocation.
   */
  if (isRelease270OrHigher(url.getParameter(Constants.RELEASE_KEY))) {
    rmiProxyFactoryBean.setRemoteInvocationFactory(RmiRemoteInvocation::new);
  } else if (isRelease263OrHigher(url.getParameter(Constants.DUBBO_VERSION_KEY))) {
    rmiProxyFactoryBean.setRemoteInvocationFactory(com.alibaba.dubbo.rpc.protocol.rmi.RmiRemoteInvocation::new);
  }
  rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
  rmiProxyFactoryBean.setServiceInterface(serviceType);
  rmiProxyFactoryBean.setCacheStub(true);
  rmiProxyFactoryBean.setLookupStubOnStartup(true);
  rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
  rmiProxyFactoryBean.afterPropertiesSet();
  return (T) rmiProxyFactoryBean.getObject();
}

代码示例来源:origin: org.apache.dubbo/dubbo

@Override
  public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
    RemoteInvocation invocation;
    /*
     package was renamed to 'org.apache.dubbo' in v2.7.0, so only provider versions after v2.7.0 can
     recognize org.apache.xxx.HttpRemoteInvocation'.
     */
    if (Version.isRelease270OrHigher(url.getParameter(Constants.RELEASE_KEY))) {
      invocation = new HttpRemoteInvocation(methodInvocation);
    } else {
      /*
       The customized 'com.alibaba.dubbo.rpc.protocol.http.HttpRemoteInvocation' was firstly introduced
       in v2.6.3. The main purpose is to support transformation of attachments in HttpProtocol, see
       https://github.com/apache/incubator-dubbo/pull/1827. To guarantee interoperability with lower
       versions, we need to check if the provider is v2.6.3 or higher before sending customized
       HttpRemoteInvocation.
       */
      if (Version.isRelease263OrHigher(url.getParameter(Constants.DUBBO_VERSION_KEY))) {
        invocation = new com.alibaba.dubbo.rpc.protocol.http.HttpRemoteInvocation(methodInvocation);
      } else {
        invocation = new RemoteInvocation(methodInvocation);
      }
    }
    if (isGeneric) {
      invocation.addAttribute(Constants.GENERIC_KEY, generic);
    }
    return invocation;
  }
});

代码示例来源:origin: org.apache.dubbo/dubbo-rpc-http

@Override
  public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
    RemoteInvocation invocation;
    /*
     package was renamed to 'org.apache.dubbo' in v2.7.0, so only provider versions after v2.7.0 can
     recognize org.apache.xxx.HttpRemoteInvocation'.
     */
    if (Version.isRelease270OrHigher(url.getParameter(Constants.RELEASE_KEY))) {
      invocation = new HttpRemoteInvocation(methodInvocation);
    } else {
      /*
       The customized 'com.alibaba.dubbo.rpc.protocol.http.HttpRemoteInvocation' was firstly introduced
       in v2.6.3. The main purpose is to support transformation of attachments in HttpProtocol, see
       https://github.com/apache/incubator-dubbo/pull/1827. To guarantee interoperability with lower
       versions, we need to check if the provider is v2.6.3 or higher before sending customized
       HttpRemoteInvocation.
       */
      if (Version.isRelease263OrHigher(url.getParameter(Constants.DUBBO_VERSION_KEY))) {
        invocation = new com.alibaba.dubbo.rpc.protocol.http.HttpRemoteInvocation(methodInvocation);
      } else {
        invocation = new RemoteInvocation(methodInvocation);
      }
    }
    if (isGeneric) {
      invocation.addAttribute(Constants.GENERIC_KEY, generic);
    }
    return invocation;
  }
});

代码示例来源:origin: org.apache.dubbo/dubbo-rpc-rmi

@Override
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
  final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
  /*
   RMI needs extra parameter since it uses customized remote invocation object
   The customized RemoteInvocation was firstly introduced in v2.6.3; The package was renamed to 'org.apache.*' since v2.7.0
   Considering the above two conditions, we need to check before sending customized RemoteInvocation:
   1. if the provider version is v2.7.0 or higher, send 'org.apache.dubbo.rpc.protocol.rmi.RmiRemoteInvocation'.
   2. if the provider version is v2.6.3 or higher, send 'com.alibaba.dubbo.rpc.protocol.rmi.RmiRemoteInvocation'.
   3. if the provider version is lower than v2.6.3, does not use customized RemoteInvocation.
   */
  if (isRelease270OrHigher(url.getParameter(Constants.RELEASE_KEY))) {
    rmiProxyFactoryBean.setRemoteInvocationFactory(RmiRemoteInvocation::new);
  } else if (isRelease263OrHigher(url.getParameter(Constants.DUBBO_VERSION_KEY))) {
    rmiProxyFactoryBean.setRemoteInvocationFactory(com.alibaba.dubbo.rpc.protocol.rmi.RmiRemoteInvocation::new);
  }
  rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
  rmiProxyFactoryBean.setServiceInterface(serviceType);
  rmiProxyFactoryBean.setCacheStub(true);
  rmiProxyFactoryBean.setLookupStubOnStartup(true);
  rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
  rmiProxyFactoryBean.afterPropertiesSet();
  return (T) rmiProxyFactoryBean.getObject();
}

代码示例来源:origin: org.apache.dubbo/dubbo

@Override
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
  final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
  /*
   RMI needs extra parameter since it uses customized remote invocation object
   The customized RemoteInvocation was firstly introduced in v2.6.3; The package was renamed to 'org.apache.*' since v2.7.0
   Considering the above two conditions, we need to check before sending customized RemoteInvocation:
   1. if the provider version is v2.7.0 or higher, send 'org.apache.dubbo.rpc.protocol.rmi.RmiRemoteInvocation'.
   2. if the provider version is v2.6.3 or higher, send 'com.alibaba.dubbo.rpc.protocol.rmi.RmiRemoteInvocation'.
   3. if the provider version is lower than v2.6.3, does not use customized RemoteInvocation.
   */
  if (isRelease270OrHigher(url.getParameter(Constants.RELEASE_KEY))) {
    rmiProxyFactoryBean.setRemoteInvocationFactory(RmiRemoteInvocation::new);
  } else if (isRelease263OrHigher(url.getParameter(Constants.DUBBO_VERSION_KEY))) {
    rmiProxyFactoryBean.setRemoteInvocationFactory(com.alibaba.dubbo.rpc.protocol.rmi.RmiRemoteInvocation::new);
  }
  rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
  rmiProxyFactoryBean.setServiceInterface(serviceType);
  rmiProxyFactoryBean.setCacheStub(true);
  rmiProxyFactoryBean.setLookupStubOnStartup(true);
  rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
  rmiProxyFactoryBean.afterPropertiesSet();
  return (T) rmiProxyFactoryBean.getObject();
}

相关文章