sessionconnectionapache-zookeeperapache-curator

what is difference between connection timeout and session timeout in curator


when we create a curator client, we have

    RetryPolicy retryPolicy = new RetryNTimes(3, 1000);
    CuratorFramework client = CuratorFrameworkFactory.newClient(zkConnectString, 
            15000, // sessionTimeoutMs
            15000, // connectionTimeoutMs
            retryPolicy);

Can someone tell what is difference between session timeout and connection timeout in the above api call?

Thank you


Solution

  • You cannot make API calls to ZooKeeper until the connection has been established (i.e. until you get SyncConnected). Curator internally waits until this connection has been established for you. connectionTimeoutMs is the max time to wait for this.