com.alibaba.dubbo.remoting.zookeeper.ChildListener Java Examples

The following examples show how to use com.alibaba.dubbo.remoting.zookeeper.ChildListener. 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: ZookeeperRegistry.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
@Override
protected void doUnsubscribe(URL url, NotifyListener listener) {
    ConcurrentMap<NotifyListener, ChildListener> listeners = zkListeners.get(url);
    if (listeners != null) {
        ChildListener zkListener = listeners.get(listener);
        if (zkListener != null) {
            if (Constants.ANY_VALUE.equals(url.getServiceInterface())) {
                String root = toRootPath();
                zkClient.removeChildListener(root, zkListener);
            } else {
                for (String path : toCategoriesPath(url)) {
                    zkClient.removeChildListener(path, zkListener);
                }
            }
        }
    }
}
 
Example #2
Source File: ZookeeperRegistry.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
protected void doUnsubscribe(URL url, NotifyListener listener) {
    ConcurrentMap<NotifyListener, ChildListener> listeners = zkListeners.get(url);
    if (listeners != null) {
        ChildListener zkListener = listeners.get(listener);
        if (zkListener != null) {
            zkClient.removeChildListener(toUrlPath(url), zkListener);
        }
    }
}
 
Example #3
Source File: ZookeeperRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
protected void doUnsubscribe(URL url, NotifyListener listener) {
    ConcurrentMap<NotifyListener, ChildListener> listeners = zkListeners.get(url);
    if (listeners != null) {
        ChildListener zkListener = listeners.get(listener);
        if (zkListener != null) {
            zkClient.removeChildListener(toUrlPath(url), zkListener);
        }
    }
}
 
Example #4
Source File: AbstractZookeeperClient.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void removeChildListener(String path, ChildListener listener) {
	ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
	if (listeners != null) {
		TargetChildListener targetListener = listeners.remove(listener);
		if (targetListener != null) {
			removeTargetChildListener(path, targetListener);
		}
	}
}
 
Example #5
Source File: AbstractZookeeperClient.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public List<String> addChildListener(String path, final ChildListener listener) {
	ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
	if (listeners == null) {
		childListeners.putIfAbsent(path, new ConcurrentHashMap<ChildListener, TargetChildListener>());
		listeners = childListeners.get(path);
	}
	TargetChildListener targetListener = listeners.get(listener);
	if (targetListener == null) {
		listeners.putIfAbsent(listener, createTargetChildListener(path, listener));
		targetListener = listeners.get(listener);
	}
	return addTargetChildListener(path, targetListener);
}
 
Example #6
Source File: ZkclientZookeeperClient.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public IZkChildListener createTargetChildListener(String path, final ChildListener listener) {
	return new IZkChildListener() {
		public void handleChildChange(String parentPath, List<String> currentChilds)
				throws Exception {
			listener.childChanged(parentPath, currentChilds);
		}
	};
}
 
Example #7
Source File: ZookeeperRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
protected void doUnsubscribe(URL url, NotifyListener listener) {
    ConcurrentMap<NotifyListener, ChildListener> listeners = zkListeners.get(url);
    if (listeners != null) {
        ChildListener zkListener = listeners.get(listener);
        if (zkListener != null) {
            zkClient.removeChildListener(toUrlPath(url), zkListener);
        }
    }
}
 
Example #8
Source File: AbstractZookeeperClient.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void removeChildListener(String path, ChildListener listener) {
	ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
	if (listeners != null) {
		TargetChildListener targetListener = listeners.remove(listener);
		if (targetListener != null) {
			removeTargetChildListener(path, targetListener);
		}
	}
}
 
Example #9
Source File: AbstractZookeeperClient.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public List<String> addChildListener(String path, final ChildListener listener) {
	ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
	if (listeners == null) {
		childListeners.putIfAbsent(path, new ConcurrentHashMap<ChildListener, TargetChildListener>());
		listeners = childListeners.get(path);
	}
	TargetChildListener targetListener = listeners.get(listener);
	if (targetListener == null) {
		listeners.putIfAbsent(listener, createTargetChildListener(path, listener));
		targetListener = listeners.get(listener);
	}
	return addTargetChildListener(path, targetListener);
}
 
Example #10
Source File: ZkclientZookeeperClient.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public IZkChildListener createTargetChildListener(String path, final ChildListener listener) {
	return new IZkChildListener() {
		public void handleChildChange(String parentPath, List<String> currentChilds)
				throws Exception {
			listener.childChanged(parentPath, currentChilds);
		}
	};
}
 
Example #11
Source File: ZookeeperRegistry.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
protected void doUnsubscribe(URL url, NotifyListener listener) {
    ConcurrentMap<NotifyListener, ChildListener> listeners = zkListeners.get(url);
    if (listeners != null) {
        ChildListener zkListener = listeners.get(listener);
        if (zkListener != null) {
            zkClient.removeChildListener(toUrlPath(url), zkListener);
        }
    }
}
 
Example #12
Source File: AbstractZookeeperClient.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public synchronized void removeChildListener(String path, ChildListener listener) {
	ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
	if (listeners != null) {
		TargetChildListener targetListener = listeners.remove(listener);
		if (targetListener != null) {
			removeTargetChildListener(path, targetListener);
		}
		if (listeners.isEmpty()) {
			childListeners.remove(path);
		}
	}
}
 
Example #13
Source File: AbstractZookeeperClient.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public synchronized List<String> addChildListener(String path, final ChildListener listener) {
	ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
	if (listeners == null) {
		childListeners.putIfAbsent(path, new ConcurrentHashMap<>());
		listeners = childListeners.get(path);
	}
	TargetChildListener targetListener = listeners.get(listener);
	if (targetListener == null) {
		listeners.putIfAbsent(listener, createTargetChildListener(path, listener));
		targetListener = listeners.get(listener);
	}
	return addTargetChildListener(path, targetListener);
}
 
Example #14
Source File: ZkclientZookeeperClient.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
public IZkChildListener createTargetChildListener(String path, final ChildListener listener) {
    return new IZkChildListener() {
        @Override
        public void handleChildChange(String parentPath, List<String> currentChilds)
                throws Exception {
            listener.childChanged(parentPath, currentChilds);
        }
    };
}
 
Example #15
Source File: AbstractZookeeperClient.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public void removeChildListener(String path, ChildListener listener) {
	ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
	if (listeners != null) {
		TargetChildListener targetListener = listeners.remove(listener);
		if (targetListener != null) {
			removeTargetChildListener(path, targetListener);
		}
	}
}
 
Example #16
Source File: AbstractZookeeperClient.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public List<String> addChildListener(String path, final ChildListener listener) {
	ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
	if (listeners == null) {
		childListeners.putIfAbsent(path, new ConcurrentHashMap<ChildListener, TargetChildListener>());
		listeners = childListeners.get(path);
	}
	TargetChildListener targetListener = listeners.get(listener);
	if (targetListener == null) {
		listeners.putIfAbsent(listener, createTargetChildListener(path, listener));
		targetListener = listeners.get(listener);
	}
	return addTargetChildListener(path, targetListener);
}
 
Example #17
Source File: AbstractZookeeperClient.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
    public List<String> addChildListener(String path, final ChildListener listener) {
        ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
        if (listeners == null) {
            childListeners.putIfAbsent(path, new ConcurrentHashMap<ChildListener, TargetChildListener>());
            listeners = childListeners.get(path);
        }
        TargetChildListener targetListener = listeners.get(listener);
        if (targetListener == null) {
            listeners.putIfAbsent(listener, createTargetChildListener(path, listener));
            targetListener = listeners.get(listener);
        }
//        添加节点监听器=》
        return addTargetChildListener(path, targetListener);
    }
 
Example #18
Source File: AbstractZookeeperClient.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
public void removeChildListener(String path, ChildListener listener) {
    ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
    if (listeners != null) {
        TargetChildListener targetListener = listeners.remove(listener);
        if (targetListener != null) {
            removeTargetChildListener(path, targetListener);
        }
    }
}
 
Example #19
Source File: ZkclientZookeeperClient.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public IZkChildListener createTargetChildListener(String path, final ChildListener listener) {
	return new IZkChildListener() {
		public void handleChildChange(String parentPath, List<String> currentChilds)
				throws Exception {
			listener.childChanged(parentPath, currentChilds);
		}
	};
}
 
Example #20
Source File: AbstractZookeeperClient.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public List<String> addChildListener(String path, final ChildListener listener) {
	ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
	if (listeners == null) {
		childListeners.putIfAbsent(path, new ConcurrentHashMap<ChildListener, TargetChildListener>());
		listeners = childListeners.get(path);
	}
	TargetChildListener targetListener = listeners.get(listener);
	if (targetListener == null) {
		listeners.putIfAbsent(listener, createTargetChildListener(path, listener));
		targetListener = listeners.get(listener);
	}
	return addTargetChildListener(path, targetListener);
}
 
Example #21
Source File: AbstractZookeeperClient.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void removeChildListener(String path, ChildListener listener) {
	ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path);
	if (listeners != null) {
		TargetChildListener targetListener = listeners.remove(listener);
		if (targetListener != null) {
			removeTargetChildListener(path, targetListener);
		}
	}
}
 
Example #22
Source File: ZkclientZookeeperClient.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public IZkChildListener createTargetChildListener(String path, final ChildListener listener) {
	return new IZkChildListener() {
		public void handleChildChange(String parentPath, List<String> currentChilds)
				throws Exception {
			listener.childChanged(parentPath, currentChilds);
		}
	};
}
 
Example #23
Source File: ZookeeperRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
protected void doUnsubscribe(URL url, NotifyListener listener) {
    ConcurrentMap<NotifyListener, ChildListener> listeners = zkListeners.get(url);
    if (listeners != null) {
        ChildListener zkListener = listeners.get(listener);
        if (zkListener != null) {
            zkClient.removeChildListener(toUrlPath(url), zkListener);
        }
    }
}
 
Example #24
Source File: CuratorZookeeperClient.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public CuratorWatcherImpl(ChildListener listener) {
	this.listener = listener;
}
 
Example #25
Source File: CuratorZookeeperClient.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public CuratorWatcher createTargetChildListener(String path,
		ChildListener listener) {
	return new CuratorWatcherImpl(listener);
}
 
Example #26
Source File: CuratorZookeeperClient.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public CuratorWatcherImpl(ChildListener listener) {
	this.listener = listener;
}
 
Example #27
Source File: CuratorZookeeperClient.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Override
public CuratorWatcher createTargetChildListener(String path, ChildListener listener) {
    return new CuratorWatcherImpl(listener);
}
 
Example #28
Source File: CuratorZookeeperClient.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
public CuratorWatcherImpl(ChildListener listener) {
    this.listener = listener;
}
 
Example #29
Source File: CuratorZookeeperClient.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public CuratorWatcher createTargetChildListener(String path,
		ChildListener listener) {
	return new CuratorWatcherImpl(listener);
}
 
Example #30
Source File: CuratorZookeeperClient.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public CuratorWatcher createTargetChildListener(String path,
		ChildListener listener) {
	return new CuratorWatcherImpl(listener);
}