zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rakesh R <rake...@huawei.com>
Subject RE: Zookeeper Watcher Problem
Date Mon, 19 May 2014 06:18:45 GMT
Hi Giorgio,

I suggest, please go through the ZooKeeper watchers functionality:
http://zookeeper.apache.org/doc/trunk/zookeeperProgrammers.html#ch_zkWatches

There are few examples zkclient available at:
http://zookeeper.apache.org/doc/r3.4.6/javaExample.html
http://zookeeper.apache.org/doc/r3.4.6/zookeeperTutorial.html


-Rakesh

-----Original Message-----
From: Giorgio Zullino [mailto:giorgiozullino@icloud.com] 
Sent: 18 May 2014 21:38
To: user@zookeeper.apache.org
Subject: Zookeeper Watcher Problem

I want information about watcher,
I must develope a MapReduce Yarn application.
I open the zookeeper connection in the main method in WordCount.java class. After I have a
Map.java class with the map method. In map method i open a new zookeeper connection in this
way:

final CountDownLatch connectedSignal = new CountDownLatch(1);
		    ZooKeeper zk = new ZooKeeper("localhost:2181", 30000, new Watcher() {
		    	@Override
		    	public void process(WatchedEvent event) {
		    		if (event.getState() == Watcher.Event.KeeperState.SyncConnected) {
		    			connectedSignal.countDown();
		    	      }
		    	}
		    });

Map class implements Watcher and i add at the end of Map class the process method. If i change
data on the znode my process method isn't called!
I wrong sure to set the Watcher :(

Mime
View raw message