You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Yuhan Zhang <yz...@onescreen.com> on 2011/12/07 22:13:05 UTC

how to set zookeeper session time to forever?

Hi all,

I'm using ZooKeeper as an event system that sends notification. This is
done by creating a zooKeeper
object, and calling getChildren(). It works fine. However, the session time
concerns me, as it is an Integer,
and a session time with Integer.MAX_VALUE in java will timeout in about 25
days. I have to keep a thread
to refresh the connection to avoid it.

Is there a particular reason that a long is not used for the sessionTime?
or will it cause a problem if zooKeeper
wait forever?

Thank you.

Yuhan

Re: how to set zookeeper session time to forever?

Posted by Patrick Hunt <ph...@apache.org>.
The client bindings are responsible for maintaining a heartbeat with
the service:
http://zookeeper.apache.org/doc/r3.3.4/zookeeperProgrammers.html#Java+Binding
there's nothing you need to do here from your application's
perspective. If the TCP connection is lost btw the client and server
(or any other reason why the client's heartbeats don't get to the
server and back, such as a GC pause on the client side) that's when
the timeout comes into play.

Patrick

On Wed, Dec 7, 2011 at 1:13 PM, Yuhan Zhang <yz...@onescreen.com> wrote:
> Hi all,
>
> I'm using ZooKeeper as an event system that sends notification. This is
> done by creating a zooKeeper
> object, and calling getChildren(). It works fine. However, the session time
> concerns me, as it is an Integer,
> and a session time with Integer.MAX_VALUE in java will timeout in about 25
> days. I have to keep a thread
> to refresh the connection to avoid it.
>
> Is there a particular reason that a long is not used for the sessionTime?
> or will it cause a problem if zooKeeper
> wait forever?
>
> Thank you.
>
> Yuhan