本文整理汇总了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();
}
}
}
}
}
示例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);
}
}
}
}
}
示例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;
}
示例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);
}
}
}
}
}
示例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);
}
}
}
}
}
示例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;
}
示例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×tamp=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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
}
}