当前位置: 首页>>代码示例>>Java>>正文


Java UrlUtils.isMatch方法代码示例

本文整理汇总了Java中com.alibaba.dubbo.common.utils.UrlUtils.isMatch方法的典型用法代码示例。如果您正苦于以下问题:Java UrlUtils.isMatch方法的具体用法?Java UrlUtils.isMatch怎么用?Java UrlUtils.isMatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.dubbo.common.utils.UrlUtils的用法示例。


在下文中一共展示了UrlUtils.isMatch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registered

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
protected void registered(URL url) {
    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL key = entry.getKey();
        if (UrlUtils.isMatch(key, url)) {
            Set<URL> urls = received.get(key);
            if (urls == null) {
                received.putIfAbsent(key, new ConcurrentHashSet<URL>());
                urls = received.get(key);
            }
            urls.add(url);
            List<URL> list = toList(urls);
            for (NotifyListener listener : entry.getValue()) {
                notify(key, listener, list);
                synchronized (listener) {
                    listener.notify();
                }
            }
        }
    }
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:21,代码来源:MulticastRegistry.java

示例2: notify

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
protected void notify(List<URL> urls) {
    if(urls == null || urls.isEmpty()) return;
    
    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL url = entry.getKey();
        
        if(! UrlUtils.isMatch(url, urls.get(0))) {
            continue;
        }
        
        Set<NotifyListener> listeners = entry.getValue();
        if (listeners != null) {
            for (NotifyListener listener : listeners) {
                try {
                    notify(url, listener, filterEmpty(url, urls));
                } catch (Throwable t) {
                    logger.error("Failed to notify registry event, urls: " +  urls + ", cause: " + t.getMessage(), t);
                }
            }
        }
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:23,代码来源:AbstractRegistry.java

示例3: getMatchedUrls

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
private List<URL> getMatchedUrls(List<URL> configuratorUrls, URL currentSubscribe) {
    List<URL> result = new ArrayList<URL>();
    for (URL url : configuratorUrls) {
        URL overrideUrl = url;
        // 兼容旧版本
        if (url.getParameter(Constants.CATEGORY_KEY) == null
                && Constants.OVERRIDE_PROTOCOL.equals(url.getProtocol())) {
            overrideUrl = url.addParameter(Constants.CATEGORY_KEY, Constants.CONFIGURATORS_CATEGORY);
        }

        //检查是不是要应用到当前服务上
        if (UrlUtils.isMatch(currentSubscribe, overrideUrl)) {
            result.add(url);
        }
    }
    return result;
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:18,代码来源:RegistryProtocol.java

示例4: notify

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
protected void notify(List<URL> urls) {
    if (urls == null || urls.isEmpty()) return;

    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL url = entry.getKey();

        if (!UrlUtils.isMatch(url, urls.get(0))) {
            continue;
        }

        Set<NotifyListener> listeners = entry.getValue();
        if (listeners != null) {
            for (NotifyListener listener : listeners) {
                try {
                    notify(url, listener, filterEmpty(url, urls));
                } catch (Throwable t) {
                    logger.error("Failed to notify registry event, urls: " + urls + ", cause: " + t.getMessage(), t);
                }
            }
        }
    }
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:23,代码来源:AbstractRegistry.java

示例5: notify

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
protected void notify(List<URL> urls) {
    if(urls == null || urls.isEmpty()) return;
    
    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL url = entry.getKey();
        //判断(消费者URL)url和(提供者URL)urls.get(0)是否匹配
        if(! UrlUtils.isMatch(url, urls.get(0))) {
            continue;
        }
        
        Set<NotifyListener> listeners = entry.getValue();
        if (listeners != null) {
            for (NotifyListener listener : listeners) {
                try {
                    notify(url, listener, filterEmpty(url, urls));
                } catch (Throwable t) {
                    logger.error("Failed to notify registry event, urls: " +  urls + ", cause: " + t.getMessage(), t);
                }
            }
        }
    }
}
 
开发者ID:DoubleSmile,项目名称:dubbo-learning,代码行数:23,代码来源:AbstractRegistry.java

示例6: toUrlsWithoutEmpty

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
/**
 * 根据consumerUrl提供的信息获得其匹配的providerUrl,获得了providerUrl就获得了服务端的address,就可以调用了。
 * @param consumer
 * @param providers
 * @return
 */
private List<URL> toUrlsWithoutEmpty(URL consumer, List<String> providers) {
	List<URL> urls = new ArrayList<URL>();
    if (providers != null && providers.size() > 0) {
        for (String provider : providers) {
            provider = URL.decode(provider);
            if (provider.contains("://")) {
                URL url = URL.valueOf(provider);
                if (UrlUtils.isMatch(consumer, url)) {
                    urls.add(url);
                }
            }
        }
    }
    return urls;
}
 
开发者ID:DoubleSmile,项目名称:dubbo-learning,代码行数:22,代码来源:ZookeeperRegistry.java

示例7: toUrlsWithoutEmpty

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
private List<URL> toUrlsWithoutEmpty(URL consumer, List<String> providers) {
	List<URL> urls = new ArrayList<URL>();
    if (providers != null && providers.size() > 0) {
        for (String provider : providers) {
            // dubbo://10.0.45.75:20880/com.geek.dubbo.test.api.UserService?anyhost=true&application=dubbo-test-provider1
            // &dubbo=2.0.0&generic=false&group=GroupA&interface=com.geek.dubbo.test.api.UserService&methods=getUser,createUser
            // &pid=1526&revision=1.0.0&side=provider&timeout=1000000&timestamp=1446621673431&version=1.0.0
            provider = URL.decode(provider);
            if (provider.contains("://")) {
                URL url = URL.valueOf(provider);
                if (UrlUtils.isMatch(consumer, url)) {
                    urls.add(url);
                }
            }
        }
    }
    return urls;
}
 
开发者ID:spccold,项目名称:dubbo-comments,代码行数:19,代码来源:ZookeeperRegistry.java

示例8: toUrlsWithoutEmpty

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
private List<URL> toUrlsWithoutEmpty(URL consumer, List<String> providers) {
	List<URL> urls = new ArrayList<URL>();
    if (providers != null && providers.size() > 0) {
        for (String provider : providers) {
            provider = URL.decode(provider);
            if (provider.contains("://")) {
                URL url = URL.valueOf(provider);
                // consumer找到provider的url
                if (UrlUtils.isMatch(consumer, url)) {
                    urls.add(url);
                }
            }
        }
    }
    return urls;
}
 
开发者ID:ketao1989,项目名称:exDubbo,代码行数:17,代码来源:ZookeeperRegistry.java

示例9: lookup

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
public List<URL> lookup(URL url) {
	List<URL> urls = new ArrayList<URL>();
	for (URL u: getRegistered()) {
        if (UrlUtils.isMatch(url, u)) {
            urls.add(u);
        }
    }
	return urls;
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:10,代码来源:SimpleRegistryService.java

示例10: unregistered

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
protected void unregistered(URL url) {
    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL key = entry.getKey();
        if (UrlUtils.isMatch(key, url)) {
            Set<URL> urls = received.get(key);
            if (urls != null) {
                urls.remove(url);
            }
            List<URL> list = toList(urls);
            for (NotifyListener listener : entry.getValue()) {
                notify(key, listener, list);
            }
        }
    }
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:16,代码来源:MulticastRegistry.java

示例11: unregistered

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
protected void unregistered(URL url) {
    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL key = entry.getKey();
        if (UrlUtils.isMatch(key, url)) {
            List<URL> list = lookup(key);
            for (NotifyListener listener : entry.getValue()) {
            	listener.notify(list);
            }
        }
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:12,代码来源:SimpleRegistryService.java

示例12: notify

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
public void notify(List<URL> urls) {
	List<URL> result = null;
	for (URL url : urls) {
		URL overrideUrl = url;
		if (url.getParameter(Constants.CATEGORY_KEY) == null
				&& Constants.OVERRIDE_PROTOCOL.equals(url.getProtocol())) {
			// 兼容旧版本
			overrideUrl = url.addParameter(Constants.CATEGORY_KEY, Constants.CONFIGURATORS_CATEGORY);
		}
		if (! UrlUtils.isMatch(subscribeUrl, overrideUrl)) {
			if (result == null) {
				result = new ArrayList<URL>(urls);
			}
			result.remove(url);
			logger.warn("Subsribe category=configurator, but notifed non-configurator urls. may be registry bug. unexcepted url: " + url);
		}
	}
	if (result != null) {
		urls = result;
	}
	this.configurators = RegistryDirectory.toConfigurators(urls);
    List<ExporterChangeableWrapper<?>> exporters = new ArrayList<ExporterChangeableWrapper<?>>(bounds.values());
    for (ExporterChangeableWrapper<?> exporter : exporters){
        Invoker<?> invoker = exporter.getOriginInvoker();
        final Invoker<?> originInvoker ;
        if (invoker instanceof InvokerDelegete){
            originInvoker = ((InvokerDelegete<?>)invoker).getInvoker();
        }else {
            originInvoker = invoker;
        }
        
        URL originUrl = RegistryProtocol.this.getProviderUrl(originInvoker);
        URL newUrl = getNewInvokerUrl(originUrl, urls);
        
        if (! originUrl.equals(newUrl)){
            RegistryProtocol.this.doChangeLocalExport(originInvoker, newUrl);
        }
    }
}
 
开发者ID:yunhaibin,项目名称:dubbox-hystrix,代码行数:40,代码来源:RegistryProtocol.java

示例13: toUrlsWithoutEmpty

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
private List<URL> toUrlsWithoutEmpty(URL consumer, List<String> providers) {
	List<URL> urls = new ArrayList<URL>();
    if (providers != null && providers.size() > 0) {
        for (String provider : providers) {
            provider = URL.decode(provider);
            if (provider.contains("://")) {
                URL url = URL.valueOf(provider);
                if (UrlUtils.isMatch(consumer, url)) {
                    urls.add(url);
                }
            }
        }
    }
    return urls;
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:16,代码来源:ZookeeperRegistry.java

示例14: registered

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
protected void registered(URL url) {
    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL key = entry.getKey();
        if (UrlUtils.isMatch(key, url)) {
            List<URL> list = lookup(key);
            for (NotifyListener listener : entry.getValue()) {
            	listener.notify(list);
            }
        }
    }
}
 
开发者ID:zhuxiaolei,项目名称:dubbo2,代码行数:12,代码来源:SimpleRegistryService.java

示例15: registered

import com.alibaba.dubbo.common.utils.UrlUtils; //导入方法依赖的package包/类
protected void registered(URL url) {
	for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
		URL key = entry.getKey();
		if (UrlUtils.isMatch(key, url)) {
			List<URL> list = lookup(key);
			for (NotifyListener listener : entry.getValue()) {
				listener.notify(list);
			}
		}
	}
}
 
开发者ID:xushaomin,项目名称:appleframework,代码行数:12,代码来源:SimpleRegistryService.java


注:本文中的com.alibaba.dubbo.common.utils.UrlUtils.isMatch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。