Reconnect to same Zookeeper server with session id fails -


my client application connects zookeeper server , creates ephemeral node:

    zookeeper zk = new zookeeper(hosturl, 40000, null);     if (zk != null) {         try {             zk.create(zpath, "test node".getbytes(),                      zoodefs.ids.open_acl_unsafe, createmode.ephemeral);         } catch (keeperexception e) {             e.printstacktrace();         } catch (interruptedexception e) {             e.printstacktrace();         }     } 

if client application crashes , restarts within session timeout period, want reconnect same zookeeper server session id received previous session:

    zookeeper zk = new zookeeper(hosturl, 40000, null, previoudsessionid, null); 

however, when try session expired exception:

12:20:26.737 [main-sendthread(172.20.34.24:2181)] info  org.apache.zookeeper.clientcnxn - opening socket connection server 172.20.34.24/172.20.34.24:2181. not attempt authenticate using sasl (unknown error) 12:20:26.737 [main-sendthread(172.20.34.24:2181)] info  org.apache.zookeeper.clientcnxn - socket connection established, initiating session, client: /172.20.34.57:50462, server: 172.20.34.24/172.20.34.24:2181 12:20:26.737 [main-sendthread(172.20.34.24:2181)] debug org.apache.zookeeper.clientcnxn - session establishment request sent on 172.20.34.24/172.20.34.24:2181 12:20:26.737 [main-sendthread(172.20.34.24:2181)] info  org.apache.zookeeper.clientcnxn - unable reconnect zookeeper service, session 0x157ff4a59300008 has expired, closing socket connection 12:20:26.747 [main-eventthread] error org.apache.zookeeper.clientcnxn - error while calling watcher  java.lang.nullpointerexception: null     @ org.apache.zookeeper.clientcnxn$eventthread.processevent(clientcnxn.java:553) [zookeeper-3.5.1-alpha.jar:3.5.1-alpha-1693007]     @ org.apache.zookeeper.clientcnxn$eventthread.run(clientcnxn.java:528) [zookeeper-3.5.1-alpha.jar:3.5.1-alpha-1693007] 12:20:26.747 [main-eventthread] info  org.apache.zookeeper.clientcnxn - eventthread shut down session: 0x157ff4a59300008 org.apache.zookeeper.keeperexception$sessionexpiredexception: keepererrorcode = session expired /ephemeral     @ org.apache.zookeeper.keeperexception.create(keeperexception.java:131)     @ org.apache.zookeeper.keeperexception.create(keeperexception.java:51)     @ org.apache.zookeeper.zookeeper.create(zookeeper.java:1209)     @ curatorexp.zookeeperexp.reconnectwithsessionid(zookeeperexp.java:53)     @ curatorexp.zookeeperexp.main(zookeeperexp.java:24) 

even after getting exception, if check zookeeper server using shell, see ephemeral node created before crash. (i have ensured reconnecting before session timeout of 40 seconds)

is expected work?


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -