com.alibaba.dubbo.common.utils.ConcurrentHashSet Java Examples

The following examples show how to use com.alibaba.dubbo.common.utils.ConcurrentHashSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleRegistryService.java    From tutorials with MIT License 6 votes vote down vote up
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);
}
 
Example #2
Source File: AbstractRegistry.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #3
Source File: SimpleRegistryService.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #4
Source File: MulticastRegistry.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
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();
                }
            }
        }
    }
}
 
Example #5
Source File: AbstractRegistry.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #6
Source File: AbstractRegistry.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #7
Source File: SimpleRegistryService.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #8
Source File: MulticastRegistry.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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();
                }
            }
        }
    }
}
 
Example #9
Source File: MulticastRegistry.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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();
                }
            }
        }
    }
}
 
Example #10
Source File: AbstractRegistry.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #11
Source File: SimpleRegistryService.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #12
Source File: SimpleRegistryService.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #13
Source File: MulticastRegistry.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
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);
            }
            if (urls == null || urls.isEmpty()){
                if (urls == null){
                    urls = new ConcurrentHashSet<URL>();
                }
                URL empty = url.setProtocol(Constants.EMPTY_PROTOCOL);
                urls.add(empty);
            }
            List<URL> list = toList(urls);
            for (NotifyListener listener : entry.getValue()) {
                notify(key, listener, list);
            }
        }
    }
}
 
Example #14
Source File: MulticastRegistry.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
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();
                }
            }
        }
    }
}
 
Example #15
Source File: SimpleRegistryService.java    From jsongood with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #16
Source File: MulticastRegistry.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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();
                }
            }
        }
    }
}
 
Example #17
Source File: AbstractRegistry.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #18
Source File: AbstractRegistry.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
@Override
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);
}
 
Example #19
Source File: FailbackRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private void addFailedSubscribed(URL url, NotifyListener listener) {
    Set<NotifyListener> listeners = failedSubscribed.get(url);
    if (listeners == null) {
        failedSubscribed.putIfAbsent(url, new ConcurrentHashSet<NotifyListener>());
        listeners = failedSubscribed.get(url);
    }
    listeners.add(listener);
}
 
Example #20
Source File: FailbackRegistry.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
@Override
public void unsubscribe(URL url, NotifyListener listener) {
    super.unsubscribe(url, listener);
    removeFailedSubscribed(url, listener);
    try {
        // 向服务器端发送取消订阅请求
        doUnsubscribe(url, listener);
    } catch (Exception e) {
        Throwable t = e;

        // 如果开启了启动时检测,则直接抛出异常
        boolean check = getUrl().getParameter(Constants.CHECK_KEY, true)
                && url.getParameter(Constants.CHECK_KEY, true);
        boolean skipFailback = t instanceof SkipFailbackWrapperException;
        if (check || skipFailback) {
            if(skipFailback) {
                t = t.getCause();
            }
            throw new IllegalStateException("Failed to unsubscribe " + url + " to registry " + getUrl().getAddress() + ", cause: " + t.getMessage(), t);
        } else {
            logger.error("Failed to unsubscribe " + url + ", waiting for retry, cause: " + t.getMessage(), t);
        }

        // 将失败的取消订阅请求记录到失败列表,定时重试
        Set<NotifyListener> listeners = failedUnsubscribed.get(url);
        if (listeners == null) {
            failedUnsubscribed.putIfAbsent(url, new ConcurrentHashSet<NotifyListener>());
            listeners = failedUnsubscribed.get(url);
        }
        listeners.add(listener);
    }
}
 
Example #21
Source File: FailbackRegistry.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
@Override
public void unsubscribe(URL url, NotifyListener listener) {
    super.unsubscribe(url, listener);
    removeFailedSubscribed(url, listener);
    try {
        // 向服务器端发送取消订阅请求
        doUnsubscribe(url, listener);
    } catch (Exception e) {
        Throwable t = e;

        // 如果开启了启动时检测,则直接抛出异常
        boolean check = getUrl().getParameter(Constants.CHECK_KEY, true)
                && url.getParameter(Constants.CHECK_KEY, true);
        boolean skipFailback = t instanceof SkipFailbackWrapperException;
        if (check || skipFailback) {
            if(skipFailback) {
                t = t.getCause();
            }
            throw new IllegalStateException("Failed to unsubscribe " + url + " to registry " + getUrl().getAddress() + ", cause: " + t.getMessage(), t);
        } else {
            logger.error("Failed to unsubscribe " + url + ", waiting for retry, cause: " + t.getMessage(), t);
        }

        // 将失败的取消订阅请求记录到失败列表,定时重试
        Set<NotifyListener> listeners = failedUnsubscribed.get(url);
        if (listeners == null) {
            failedUnsubscribed.putIfAbsent(url, new ConcurrentHashSet<NotifyListener>());
            listeners = failedUnsubscribed.get(url);
        }
        listeners.add(listener);
    }
}
 
Example #22
Source File: SimpleRegistryService.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void register(URL url) {
    String client = RpcContext.getContext().getRemoteAddressString();
    Set<URL> urls = remoteRegistered.get(client);
    if (urls == null) {
        remoteRegistered.putIfAbsent(client, new ConcurrentHashSet<URL>());
        urls = remoteRegistered.get(client);
    }
    urls.add(url);
    super.register(url);
    registered(url);
}
 
Example #23
Source File: SimpleRegistryService.java    From tutorials with MIT License 5 votes vote down vote up
public void register(URL url) {
    String client = RpcContext.getContext().getRemoteAddressString();
    Set<URL> urls = remoteRegistered.get(client);
    if (urls == null) {
        remoteRegistered.putIfAbsent(client, new ConcurrentHashSet<URL>());
        urls = remoteRegistered.get(client);
    }
    urls.add(url);
    super.register(url);
    registered(url);
}
 
Example #24
Source File: TraceFilter.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static void addTracer(Class<?> type, String method, Channel channel, int max) {
    channel.setAttribute(TRACE_MAX, max);
    channel.setAttribute(TRACE_COUNT, new AtomicInteger());
    String key = method != null && method.length() > 0 ? type.getName() + "." + method : type.getName();
    Set<Channel> channels = tracers.get(key);
    if (channels == null) {
        tracers.putIfAbsent(key, new ConcurrentHashSet<Channel>());
        channels = tracers.get(key);
    }
    channels.add(channel);
}
 
Example #25
Source File: AccessLogFilter.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private void log(String accesslog, String logmessage) {
    init();
    Set<String> logSet = logQueue.get(accesslog);
    if (logSet == null) {
        logQueue.putIfAbsent(accesslog, new ConcurrentHashSet<String>());
        logSet = logQueue.get(accesslog);
    }
    if (logSet.size() < LOG_MAX_BUFFER) {
        logSet.add(logmessage);
    }
}
 
Example #26
Source File: SimpleRegistryService.java    From jsongood with Apache License 2.0 5 votes vote down vote up
public void register(URL url) {
    String client = RpcContext.getContext().getRemoteAddressString();
    Set<URL> urls = remoteRegistered.get(client);
    if (urls == null) {
        remoteRegistered.putIfAbsent(client, new ConcurrentHashSet<URL>());
        urls = remoteRegistered.get(client);
    }
    urls.add(url);
    super.register(url);
    registered(url);
}
 
Example #27
Source File: FailbackRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Override
public void unsubscribe(URL url, NotifyListener listener) {
    super.unsubscribe(url, listener);
    removeFailedSubscribed(url, listener);
    try {
        // 向服务器端发送取消订阅请求
        doUnsubscribe(url, listener);
    } catch (Exception e) {
        Throwable t = e;

        // 如果开启了启动时检测,则直接抛出异常
        boolean check = getUrl().getParameter(Constants.CHECK_KEY, true)
                && url.getParameter(Constants.CHECK_KEY, true);
        boolean skipFailback = t instanceof SkipFailbackWrapperException;
        if (check || skipFailback) {
            if(skipFailback) {
                t = t.getCause();
            }
            throw new IllegalStateException("Failed to unsubscribe " + url + " to registry " + getUrl().getAddress() + ", cause: " + t.getMessage(), t);
        } else {
            logger.error("Failed to unsubscribe " + url + ", waiting for retry, cause: " + t.getMessage(), t);
        }

        // 将失败的取消订阅请求记录到失败列表,定时重试
        Set<NotifyListener> listeners = failedUnsubscribed.get(url);
        if (listeners == null) {
            failedUnsubscribed.putIfAbsent(url, new ConcurrentHashSet<NotifyListener>());
            listeners = failedUnsubscribed.get(url);
        }
        listeners.add(listener);
    }
}
 
Example #28
Source File: FailbackRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Override
public void unsubscribe(URL url, NotifyListener listener) {
    super.unsubscribe(url, listener);
    removeFailedSubscribed(url, listener);
    try {
        // 向服务器端发送取消订阅请求
        doUnsubscribe(url, listener);
    } catch (Exception e) {
        Throwable t = e;

        // 如果开启了启动时检测,则直接抛出异常
        boolean check = getUrl().getParameter(Constants.CHECK_KEY, true)
                && url.getParameter(Constants.CHECK_KEY, true);
        boolean skipFailback = t instanceof SkipFailbackWrapperException;
        if (check || skipFailback) {
            if(skipFailback) {
                t = t.getCause();
            }
            throw new IllegalStateException("Failed to unsubscribe " + url + " to registry " + getUrl().getAddress() + ", cause: " + t.getMessage(), t);
        } else {
            logger.error("Failed to unsubscribe " + url + ", waiting for retry, cause: " + t.getMessage(), t);
        }

        // 将失败的取消订阅请求记录到失败列表,定时重试
        Set<NotifyListener> listeners = failedUnsubscribed.get(url);
        if (listeners == null) {
            failedUnsubscribed.putIfAbsent(url, new ConcurrentHashSet<NotifyListener>());
            listeners = failedUnsubscribed.get(url);
        }
        listeners.add(listener);
    }
}
 
Example #29
Source File: FailbackRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private void addFailedSubscribed(URL url, NotifyListener listener) {
    Set<NotifyListener> listeners = failedSubscribed.get(url);
    if (listeners == null) {
        failedSubscribed.putIfAbsent(url, new ConcurrentHashSet<NotifyListener>());
        listeners = failedSubscribed.get(url);
    }
    listeners.add(listener);
}
 
Example #30
Source File: SimpleRegistryService.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void register(URL url) {
    String client = RpcContext.getContext().getRemoteAddressString();
    Set<URL> urls = remoteRegistered.get(client);
    if (urls == null) {
        remoteRegistered.putIfAbsent(client, new ConcurrentHashSet<URL>());
        urls = remoteRegistered.get(client);
    }
    urls.add(url);
    super.register(url);
    registered(url);
}