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


Java ConcurrentHashSet类代码示例

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


ConcurrentHashSet类属于com.alibaba.dubbo.common.utils包,在下文中一共展示了ConcurrentHashSet类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: subscribe

import com.alibaba.dubbo.common.utils.ConcurrentHashSet; //导入依赖的package包/类
public void subscribe(URL url, NotifyListener listener) {
    if (getUrl().getPort() == 0) {
        URL registryUrl = RpcContext.getContext().getUrl();
        if (registryUrl != null && registryUrl.getPort() > 0
        		&& RegistryService.class.getName().equals(registryUrl.getPath())) {
            super.setUrl(registryUrl);
            super.register(registryUrl);
        }
    }
    String client = RpcContext.getContext().getRemoteAddressString();
    ConcurrentMap<URL, Set<NotifyListener>> clientListeners = remoteSubscribed.get(client);
    if (clientListeners == null) {
        remoteSubscribed.putIfAbsent(client, new ConcurrentHashMap<URL, Set<NotifyListener>>());
        clientListeners = remoteSubscribed.get(client);
    }
    Set<NotifyListener> listeners = clientListeners.get(url);
    if (listeners == null) {
        clientListeners.putIfAbsent(url, new ConcurrentHashSet<NotifyListener>());
        listeners = clientListeners.get(url);
    }
    listeners.add(listener);
    super.subscribe(url, listener);
    subscribed(url, listener);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:25,代码来源:SimpleRegistryService.java

示例2: subscribe

import com.alibaba.dubbo.common.utils.ConcurrentHashSet; //导入依赖的package包/类
public void subscribe(URL url, NotifyListener listener) {
    if (url == null) {
        throw new IllegalArgumentException("subscribe url == null");
    }
    if (listener == null) {
        throw new IllegalArgumentException("subscribe listener == null");
    }
    if (logger.isInfoEnabled()){
        logger.info("Subscribe: " + url);
    }
    Set<NotifyListener> listeners = subscribed.get(url);
    if (listeners == null) {
        subscribed.putIfAbsent(url, new ConcurrentHashSet<NotifyListener>());
        listeners = subscribed.get(url);
    }
    listeners.add(listener);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:18,代码来源:AbstractRegistry.java

示例3: registered

import com.alibaba.dubbo.common.utils.ConcurrentHashSet; //导入依赖的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:dachengxi,项目名称:EatDubbo,代码行数:21,代码来源:MulticastRegistry.java

示例4: subscribe

import com.alibaba.dubbo.common.utils.ConcurrentHashSet; //导入依赖的package包/类
public void subscribe(URL url, NotifyListener listener) {
    if (url == null) {
        throw new IllegalArgumentException("subscribe url == null");
    }
    if (listener == null) {
        throw new IllegalArgumentException("subscribe listener == null");
    }
    if (logger.isInfoEnabled()) {
        logger.info("Subscribe: " + url);
    }
    Set<NotifyListener> listeners = subscribed.get(url);
    if (listeners == null) {
        subscribed.putIfAbsent(url, new ConcurrentHashSet<NotifyListener>());
        listeners = subscribed.get(url);
    }
    listeners.add(listener);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:18,代码来源:AbstractRegistry.java

示例5: subscribe

import com.alibaba.dubbo.common.utils.ConcurrentHashSet; //导入依赖的package包/类
public void subscribe(URL url, NotifyListener listener) {
	if (url == null) {
		throw new IllegalArgumentException("subscribe url == null");
	}
	if (listener == null) {
		throw new IllegalArgumentException("subscribe listener == null");
	}
	if (log.isInfoEnabled()) {
		log.info("Subscribe: " + url);
	}
	Set<NotifyListener> listeners = subscribed.get(url);
	if (listeners == null) {
		subscribed.putIfAbsent(url, new ConcurrentHashSet<NotifyListener>());
		listeners = subscribed.get(url);
	}
	listeners.add(listener);
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:18,代码来源:AbstractRegistry.java


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