public void addUrlToRetry(List<URL> urls) { if (CollectionUtils.isEmpty(urls)) { return; } this.urls.addAll(urls); }
@Deprecated private static List<ProtocolConfig> convertProviderToProtocol(List<ProviderConfig> providers) { if (CollectionUtils.isEmpty(providers)) { return null; } List<ProtocolConfig> protocols = new ArrayList<ProtocolConfig>(providers.size()); for (ProviderConfig provider : providers) { protocols.add(convertProviderToProtocol(provider)); } return protocols; }
protected static List<URL> filterEmpty(URL url, List<URL> urls) { if (CollectionUtils.isEmpty(urls)) { List<URL> result = new ArrayList<>(1); result.add(url.setProtocol(Constants.EMPTY_PROTOCOL)); return result; } return urls; }
protected static List<URL> filterEmpty(URL url, List<URL> urls) { if (CollectionUtils.isEmpty(urls)) { List<URL> result = new ArrayList<>(1); result.add(url.setProtocol(Constants.EMPTY_PROTOCOL)); return result; } return urls; }
@Override public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (CollectionUtils.isEmpty(invokers) || conditionRouters.size() == 0) { return invokers; } // We will check enabled status inside each router. for (Router router : conditionRouters) { invokers = router.route(invokers, url, invocation); } return invokers; }
@Override public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) { if (CollectionUtils.isEmpty(invokers)) { return null; } if (invokers.size() == 1) { return invokers.get(0); } return doSelect(invokers, url, invocation); }
@Deprecated private static List<ProtocolConfig> convertProviderToProtocol(List<ProviderConfig> providers) { if (CollectionUtils.isEmpty(providers)) { return null; } List<ProtocolConfig> protocols = new ArrayList<ProtocolConfig>(providers.size()); for (ProviderConfig provider : providers) { protocols.add(convertProviderToProtocol(provider)); } return protocols; }
@Override public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) { if (CollectionUtils.isEmpty(invokers)) { return null; } if (invokers.size() == 1) { return invokers.get(0); } return doSelect(invokers, url, invocation); }
@Deprecated private static List<ProviderConfig> convertProtocolToProvider(List<ProtocolConfig> protocols) { if (CollectionUtils.isEmpty(protocols)) { return null; } List<ProviderConfig> providers = new ArrayList<ProviderConfig>(protocols.size()); for (ProtocolConfig provider : protocols) { providers.add(convertProtocolToProvider(provider)); } return providers; }
@Deprecated private static List<ProviderConfig> convertProtocolToProvider(List<ProtocolConfig> protocols) { if (CollectionUtils.isEmpty(protocols)) { return null; } List<ProviderConfig> providers = new ArrayList<ProviderConfig>(protocols.size()); for (ProtocolConfig provider : protocols) { providers.add(convertProtocolToProvider(provider)); } return providers; }
@Override public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (CollectionUtils.isEmpty(invokers) || conditionRouters.size() == 0) { return invokers; } // We will check enabled status inside each router. for (Router router : conditionRouters) { invokers = router.route(invokers, url, invocation); } return invokers; }
public URL removeParameters(Collection<String> keys) { if (CollectionUtils.isEmpty(keys)) { return this; } return removeParameters(keys.toArray(new String[0])); }
public StaticDirectory(URL url, List<Invoker<T>> invokers, RouterChain<T> routerChain) { super(url == null && CollectionUtils.isNotEmpty(invokers) ? invokers.get(0).getUrl() : url, routerChain); if (CollectionUtils.isEmpty(invokers)) { throw new IllegalArgumentException("invokers == null"); } this.invokers = invokers; }
public StaticDirectory(URL url, List<Invoker<T>> invokers, RouterChain<T> routerChain) { super(url == null && CollectionUtils.isNotEmpty(invokers) ? invokers.get(0).getUrl() : url, routerChain); if (CollectionUtils.isEmpty(invokers)) { throw new IllegalArgumentException("invokers == null"); } this.invokers = invokers; }
void deletePath(String category) { List<String> urlStrs = zkClient.getChildren(category); if (CollectionUtils.isEmpty(urlStrs)) { return; } for (String urlStr : urlStrs) { zkClient.delete(category + Constants.PATH_SEPARATOR + urlStr); } }
void deletePath(String category) { List<String> urlStrs = zkClient.getChildren(category); if (CollectionUtils.isEmpty(urlStrs)) { return; } for (String urlStr : urlStrs) { zkClient.delete(category + Constants.PATH_SEPARATOR + urlStr); } }
public static ConditionRouterRule parse(String rawRule) { Constructor constructor = new Constructor(ConditionRouterRule.class); Yaml yaml = new Yaml(constructor); ConditionRouterRule rule = yaml.load(rawRule); rule.setRawRule(rawRule); if (CollectionUtils.isEmpty(rule.getConditions())) { rule.setValid(false); } return rule; }
private void checkProtocol() { if (CollectionUtils.isEmpty(protocols) && provider != null) { setProtocols(provider.getProtocols()); } convertProtocolIdsToProtocols(); }
protected void checkInvokers(List<Invoker<T>> invokers, Invocation invocation) { if (CollectionUtils.isEmpty(invokers)) { throw new RpcException(RpcException.NO_INVOKER_AVAILABLE_AFTER_FILTER, "Failed to invoke the method " + invocation.getMethodName() + " in the service " + getInterface().getName() + ". No provider available for the service " + directory.getUrl().getServiceKey() + " from registry " + directory.getUrl().getAddress() + " on the consumer " + NetUtils.getLocalHost() + " using the dubbo version " + Version.getVersion() + ". Please check if the providers have been started and registered."); } }
protected void checkInvokers(List<Invoker<T>> invokers, Invocation invocation) { if (CollectionUtils.isEmpty(invokers)) { throw new RpcException(RpcException.NO_INVOKER_AVAILABLE_AFTER_FILTER, "Failed to invoke the method " + invocation.getMethodName() + " in the service " + getInterface().getName() + ". No provider available for the service " + directory.getUrl().getServiceKey() + " from registry " + directory.getUrl().getAddress() + " on the consumer " + NetUtils.getLocalHost() + " using the dubbo version " + Version.getVersion() + ". Please check if the providers have been started and registered."); } }