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

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

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

URL.hasParameter介绍

暂无

代码示例

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

@Override
public boolean hasParameter(String key) {
  return super.hasParameter(key);
}

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

@Override
public boolean hasParameter(String key) {
  return super.hasParameter(key);
}

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

public URL addParameterIfAbsent(String key, String value) {
  if (StringUtils.isEmpty(key)
      || StringUtils.isEmpty(value)) {
    return this;
  }
  if (hasParameter(key)) {
    return this;
  }
  Map<String, String> map = new HashMap<String, String>(getParameters());
  map.put(key, value);
  return new URL(protocol, username, password, host, port, path, map);
}

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

public URL addParameterIfAbsent(String key, String value) {
  if (StringUtils.isEmpty(key)
      || StringUtils.isEmpty(value)) {
    return this;
  }
  if (hasParameter(key)) {
    return this;
  }
  Map<String, String> map = new HashMap<String, String>(getParameters());
  map.put(key, value);
  return new URL(protocol, username, password, host, port, path, map);
}

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

if (url.hasParameter(Constants.TIMEOUT_KEY)) {
  int t = url.getParameter(Constants.TIMEOUT_KEY, 0);
  if (t > 0) {
if (url.hasParameter(Constants.CONNECT_TIMEOUT_KEY)) {
  int t = url.getParameter(Constants.CONNECT_TIMEOUT_KEY, 0);
  if (t > 0) {
if (url.hasParameter(Constants.CODEC_KEY)) {
  this.codec = getChannelCodec(url);

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

if (url.hasParameter(Constants.TIMEOUT_KEY)) {
  int t = url.getParameter(Constants.TIMEOUT_KEY, 0);
  if (t > 0) {
if (url.hasParameter(Constants.CONNECT_TIMEOUT_KEY)) {
  int t = url.getParameter(Constants.CONNECT_TIMEOUT_KEY, 0);
  if (t > 0) {
if (url.hasParameter(Constants.CODEC_KEY)) {
  this.codec = getChannelCodec(url);

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

if (url.hasParameter(Constants.ACCEPTS_KEY)) {
  int a = url.getParameter(Constants.ACCEPTS_KEY, 0);
  if (a > 0) {
if (url.hasParameter(Constants.IDLE_TIMEOUT_KEY)) {
  int t = url.getParameter(Constants.IDLE_TIMEOUT_KEY, 0);
  if (t > 0) {
if (url.hasParameter(Constants.THREADS_KEY)
    && executor instanceof ThreadPoolExecutor && !executor.isShutdown()) {
  ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor;

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

if (url.hasParameter(Constants.ACCEPTS_KEY)) {
  int a = url.getParameter(Constants.ACCEPTS_KEY, 0);
  if (a > 0) {
if (url.hasParameter(Constants.IDLE_TIMEOUT_KEY)) {
  int t = url.getParameter(Constants.IDLE_TIMEOUT_KEY, 0);
  if (t > 0) {
if (url.hasParameter(Constants.THREADS_KEY)
    && executor instanceof ThreadPoolExecutor && !executor.isShutdown()) {
  ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor;

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

public RpcInvocation(Invocation invocation, Invoker<?> invoker) {
  this(invocation.getMethodName(), invocation.getParameterTypes(),
      invocation.getArguments(), new HashMap<String, String>(invocation.getAttachments()),
      invocation.getInvoker());
  if (invoker != null) {
    URL url = invoker.getUrl();
    setAttachment(Constants.PATH_KEY, url.getPath());
    if (url.hasParameter(Constants.INTERFACE_KEY)) {
      setAttachment(Constants.INTERFACE_KEY, url.getParameter(Constants.INTERFACE_KEY));
    }
    if (url.hasParameter(Constants.GROUP_KEY)) {
      setAttachment(Constants.GROUP_KEY, url.getParameter(Constants.GROUP_KEY));
    }
    if (url.hasParameter(Constants.VERSION_KEY)) {
      setAttachment(Constants.VERSION_KEY, url.getParameter(Constants.VERSION_KEY, "0.0.0"));
    }
    if (url.hasParameter(Constants.TIMEOUT_KEY)) {
      setAttachment(Constants.TIMEOUT_KEY, url.getParameter(Constants.TIMEOUT_KEY));
    }
    if (url.hasParameter(Constants.TOKEN_KEY)) {
      setAttachment(Constants.TOKEN_KEY, url.getParameter(Constants.TOKEN_KEY));
    }
    if (url.hasParameter(Constants.APPLICATION_KEY)) {
      setAttachment(Constants.APPLICATION_KEY, url.getParameter(Constants.APPLICATION_KEY));
    }
  }
}

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

public RpcInvocation(Invocation invocation, Invoker<?> invoker) {
  this(invocation.getMethodName(), invocation.getParameterTypes(),
      invocation.getArguments(), new HashMap<String, String>(invocation.getAttachments()),
      invocation.getInvoker());
  if (invoker != null) {
    URL url = invoker.getUrl();
    setAttachment(Constants.PATH_KEY, url.getPath());
    if (url.hasParameter(Constants.INTERFACE_KEY)) {
      setAttachment(Constants.INTERFACE_KEY, url.getParameter(Constants.INTERFACE_KEY));
    }
    if (url.hasParameter(Constants.GROUP_KEY)) {
      setAttachment(Constants.GROUP_KEY, url.getParameter(Constants.GROUP_KEY));
    }
    if (url.hasParameter(Constants.VERSION_KEY)) {
      setAttachment(Constants.VERSION_KEY, url.getParameter(Constants.VERSION_KEY, "0.0.0"));
    }
    if (url.hasParameter(Constants.TIMEOUT_KEY)) {
      setAttachment(Constants.TIMEOUT_KEY, url.getParameter(Constants.TIMEOUT_KEY));
    }
    if (url.hasParameter(Constants.TOKEN_KEY)) {
      setAttachment(Constants.TOKEN_KEY, url.getParameter(Constants.TOKEN_KEY));
    }
    if (url.hasParameter(Constants.APPLICATION_KEY)) {
      setAttachment(Constants.APPLICATION_KEY, url.getParameter(Constants.APPLICATION_KEY));
    }
  }
}

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

try {
  boolean enabled = true;
  if (url.hasParameter(Constants.DISABLED_KEY)) {
    enabled = !url.getParameter(Constants.DISABLED_KEY, false);
  } else {

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

/**
 * The invocation interceptor,it will collect the invoke data about this invocation and send it to monitor center
 *
 * @param invoker    service
 * @param invocation invocation.
 * @return {@link Result} the invoke result
 * @throws RpcException
 */
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
  if (invoker.getUrl().hasParameter(Constants.MONITOR_KEY)) {
    RpcContext context = RpcContext.getContext(); // provider must fetch context before invoke() gets called
    String remoteHost = context.getRemoteHost();
    long start = System.currentTimeMillis(); // record start timestamp
    getConcurrent(invoker, invocation).incrementAndGet(); // count up
    try {
      Result result = invoker.invoke(invocation); // proceed invocation chain
      collect(invoker, invocation, result, remoteHost, start, false);
      return result;
    } catch (RpcException e) {
      collect(invoker, invocation, null, remoteHost, start, true);
      throw e;
    } finally {
      getConcurrent(invoker, invocation).decrementAndGet(); // count down
    }
  } else {
    return invoker.invoke(invocation);
  }
}

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

/**
 * The invocation interceptor,it will collect the invoke data about this invocation and send it to monitor center
 *
 * @param invoker    service
 * @param invocation invocation.
 * @return {@link Result} the invoke result
 * @throws RpcException
 */
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
  if (invoker.getUrl().hasParameter(Constants.MONITOR_KEY)) {
    RpcContext context = RpcContext.getContext(); // provider must fetch context before invoke() gets called
    String remoteHost = context.getRemoteHost();
    long start = System.currentTimeMillis(); // record start timestamp
    getConcurrent(invoker, invocation).incrementAndGet(); // count up
    try {
      Result result = invoker.invoke(invocation); // proceed invocation chain
      collect(invoker, invocation, result, remoteHost, start, false);
      return result;
    } catch (RpcException e) {
      collect(invoker, invocation, null, remoteHost, start, true);
      throw e;
    } finally {
      getConcurrent(invoker, invocation).decrementAndGet(); // count down
    }
  } else {
    return invoker.invoke(invocation);
  }
}

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

try {
  boolean enabled = true;
  if (url.hasParameter(Constants.DISABLED_KEY)) {
    enabled = !url.getParameter(Constants.DISABLED_KEY, false);
  } else {

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

Class<?> serviceType = invoker.getInterface();
if (ConfigUtils.isDefault(stub)) {
  if (invoker.getUrl().hasParameter(Constants.STUB_KEY)) {
    stub = serviceType.getName() + "Stub";
  } else {

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

Class<?> serviceType = invoker.getInterface();
if (ConfigUtils.isDefault(stub)) {
  if (invoker.getUrl().hasParameter(Constants.STUB_KEY)) {
    stub = serviceType.getName() + "Stub";
  } else {

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

@Override
public boolean hasParameter(String key) {
  return super.hasParameter(key);
}

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

@Override
public boolean hasParameter(String key) {
  return super.hasParameter(key);
}

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

public URL addParameterIfAbsent(String key, String value) {
  if (key == null || key.length() == 0
      || value == null || value.length() == 0) {
    return this;
  }
  if (hasParameter(key)) {
    return this;
  }
  Map<String, String> map = new HashMap<String, String>(getParameters());
  map.put(key, value);
  return new URL(protocol, username, password, host, port, path, map);
}

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

public URL addParameterIfAbsent(String key, String value) {
  if (key == null || key.length() == 0
      || value == null || value.length() == 0) {
    return this;
  }
  if (hasParameter(key)) {
    return this;
  }
  Map<String, String> map = new HashMap<String, String>(getParameters());
  map.put(key, value);
  return new URL(protocol, username, password, host, port, path, map);
}

相关文章

微信公众号

最新文章

更多