Hi All,
I am using zookeeper to register cluster nodes. In my system the default
scenario we have multiple thrift services(different services and default
mode 1 thrift service for each in a single jvm ) registering them selves
(default try out mode), In that case one service makes parent nodes others
just checks the existence of parent and in-case it doesn't exist they will
make the parent nodes and register with the ephemaral node.
When I start my jvm I see the last thrift service always consistently fail
and when I add a thread sleep it worked. When I start the last service in a
separate jvm it works. Is there anything I am doing wrong.
Code looks as below for failing service. Other services does the same.
zk = new ZooKeeper(zkhostPort, 6000, this); // no watcher is required,
this will only use to store some data
String gfacServer =
ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NODE);
Thread.sleep(1000); // this fixed my issue but not sure why
its failing
Stat zkStat = zk.exists(gfacServer, false);
if (zkStat == null) {
zk.create(gfacServer, new byte[0],
ZooDefs.Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
String instantNode = gfacServer + File.separator +
String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
zkStat = zk.exists(instantNode, false);
if (zkStat == null) {
zk.create(instantNode,
airavataServerHostPort.getBytes(),
ZooDefs.Ids.OPEN_ACL_UNSAFE,
CreateMode.EPHEMERAL); // other component
will watch these childeren creation deletion to monitor the status of the
node
Am I doing anything wrong ?
Regards
Lahiru
I am using zookeeper to register cluster nodes. In my system the default
scenario we have multiple thrift services(different services and default
mode 1 thrift service for each in a single jvm ) registering them selves
(default try out mode), In that case one service makes parent nodes others
just checks the existence of parent and in-case it doesn't exist they will
make the parent nodes and register with the ephemaral node.
When I start my jvm I see the last thrift service always consistently fail
and when I add a thread sleep it worked. When I start the last service in a
separate jvm it works. Is there anything I am doing wrong.
Code looks as below for failing service. Other services does the same.
zk = new ZooKeeper(zkhostPort, 6000, this); // no watcher is required,
this will only use to store some data
String gfacServer =
ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NODE);
Thread.sleep(1000); // this fixed my issue but not sure why
its failing
Stat zkStat = zk.exists(gfacServer, false);
if (zkStat == null) {
zk.create(gfacServer, new byte[0],
ZooDefs.Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
String instantNode = gfacServer + File.separator +
String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
zkStat = zk.exists(instantNode, false);
if (zkStat == null) {
zk.create(instantNode,
airavataServerHostPort.getBytes(),
ZooDefs.Ids.OPEN_ACL_UNSAFE,
CreateMode.EPHEMERAL); // other component
will watch these childeren creation deletion to monitor the status of the
node
Am I doing anything wrong ?
Regards
Lahiru