timer.schedule(task, 0, 10000);
}
public void initZk() throws Exception{
ZooKeeper zk = new ZooKeeper(DemoConf.host + DemoConf.root, Constants.SESSION_TIMEOUT, null);
List<ACL> acls = new ArrayList<ACL>();
acls.add(new ACL(Perms.ALL, Ids.ANYONE_ID_UNSAFE));
if(zk.exists("/IserviceDemoTest", false) == null){
zk.create("/IserviceDemoTest", "".getBytes(), acls, CreateMode.PERSISTENT);
zk.create("/IserviceDemoTest/group1", "".getBytes(), acls, CreateMode.PERSISTENT);
zk.create("/IserviceDemoTest/group2", "".getBytes(), acls, CreateMode.PERSISTENT);
zk.create("/IserviceDemoTest/group1/app1", "".getBytes(), acls, CreateMode.PERSISTENT);
zk.create("/IserviceDemoTest/group1/app2", "".getBytes(), acls, CreateMode.PERSISTENT);
zk.create("/IserviceDemoTest/group1/app2/key1", "in group1/app2, i'm key1 version-1".getBytes(), acls, CreateMode.PERSISTENT);
zk.create("/IserviceDemoTest/group1/app2/key2", "".getBytes(), acls, CreateMode.PERSISTENT);
}
}