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

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

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

URL.toIdentityString介绍

暂无

代码示例

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

@Override
public String toIdentityString() {
  return super.toIdentityString();
}

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

@Override
public String toIdentityString(String... parameters) {
  return super.toIdentityString(parameters);
}

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

@Override
public String toIdentityString() {
  return super.toIdentityString();
}

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

@Override
public String toIdentityString(String... parameters) {
  return super.toIdentityString(parameters);
}

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

/**
 * @param url
 */
public static void removeStatus(URL url) {
  String uri = url.toIdentityString();
  SERVICE_STATISTICS.remove(uri);
}

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

/**
 * @param url
 */
public static void removeStatus(URL url) {
  String uri = url.toIdentityString();
  SERVICE_STATISTICS.remove(uri);
}

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

/**
 * @param url
 */
public static void removeStatus(URL url, String methodName) {
  String uri = url.toIdentityString();
  ConcurrentMap<String, RpcStatus> map = METHOD_STATISTICS.get(uri);
  if (map != null) {
    map.remove(methodName);
  }
}

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

/**
 * @param url
 */
public static void removeStatus(URL url, String methodName) {
  String uri = url.toIdentityString();
  ConcurrentMap<String, RpcStatus> map = METHOD_STATISTICS.get(uri);
  if (map != null) {
    map.remove(methodName);
  }
}

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

/**
 * @param url
 * @return status
 */
public static RpcStatus getStatus(URL url) {
  String uri = url.toIdentityString();
  RpcStatus status = SERVICE_STATISTICS.get(uri);
  if (status == null) {
    SERVICE_STATISTICS.putIfAbsent(uri, new RpcStatus());
    status = SERVICE_STATISTICS.get(uri);
  }
  return status;
}

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

/**
 * @param url
 * @return status
 */
public static RpcStatus getStatus(URL url) {
  String uri = url.toIdentityString();
  RpcStatus status = SERVICE_STATISTICS.get(uri);
  if (status == null) {
    SERVICE_STATISTICS.putIfAbsent(uri, new RpcStatus());
    status = SERVICE_STATISTICS.get(uri);
  }
  return status;
}

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

/**
 * @param url
 * @param methodName
 * @return status
 */
public static RpcStatus getStatus(URL url, String methodName) {
  String uri = url.toIdentityString();
  ConcurrentMap<String, RpcStatus> map = METHOD_STATISTICS.get(uri);
  if (map == null) {
    METHOD_STATISTICS.putIfAbsent(uri, new ConcurrentHashMap<String, RpcStatus>());
    map = METHOD_STATISTICS.get(uri);
  }
  RpcStatus status = map.get(methodName);
  if (status == null) {
    map.putIfAbsent(methodName, new RpcStatus());
    status = map.get(methodName);
  }
  return status;
}

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

/**
 * @param url
 * @param methodName
 * @return status
 */
public static RpcStatus getStatus(URL url, String methodName) {
  String uri = url.toIdentityString();
  ConcurrentMap<String, RpcStatus> map = METHOD_STATISTICS.get(uri);
  if (map == null) {
    METHOD_STATISTICS.putIfAbsent(uri, new ConcurrentHashMap<String, RpcStatus>());
    map = METHOD_STATISTICS.get(uri);
  }
  RpcStatus status = map.get(methodName);
  if (status == null) {
    map.putIfAbsent(methodName, new RpcStatus());
    status = map.get(methodName);
  }
  return status;
}

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

WeightedRoundRobin selectedWRR = null;
for (Invoker<T> invoker : invokers) {
  String identifyString = invoker.getUrl().toIdentityString();
  WeightedRoundRobin weightedRoundRobin = map.get(identifyString);
  int weight = getWeight(invoker, invocation);

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

WeightedRoundRobin selectedWRR = null;
for (Invoker<T> invoker : invokers) {
  String identifyString = invoker.getUrl().toIdentityString();
  WeightedRoundRobin weightedRoundRobin = map.get(identifyString);
  int weight = getWeight(invoker, invocation);

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

String key = url.toIdentityString();
if (isGeneric) {
  key = key + "/" + Constants.GENERIC_KEY;

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

String key = url.toIdentityString();
if (isGeneric) {
  key = key + "/" + Constants.GENERIC_KEY;

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

@Override
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
  ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean();
  proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString());
  proxyFactoryBean.setServiceClass(serviceType);
  proxyFactoryBean.setBus(bus);
  T ref = (T) proxyFactoryBean.create();
  Client proxy = ClientProxy.getClient(ref);
  HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
  HTTPClientPolicy policy = new HTTPClientPolicy();
  policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
  policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
  conduit.setClient(policy);
  return ref;
}

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

@Override
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
  ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean();
  proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString());
  proxyFactoryBean.setServiceClass(serviceType);
  proxyFactoryBean.setBus(bus);
  T ref = (T) proxyFactoryBean.create();
  Client proxy = ClientProxy.getClient(ref);
  HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
  HTTPClientPolicy policy = new HTTPClientPolicy();
  policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
  policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
  conduit.setClient(policy);
  return ref;
}

代码示例来源: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();
}

相关文章

微信公众号

最新文章

更多