Enrico,
Thanks for your reply.
Still I cannot understand how session expire detected on client side. The
only codepath
KeeperState.Expired generated is ClientCnxn#onConnected. It seems only
called on
client successfully connected to server. However, session could expire
after connection
established. Where is the latter case trigger?
Best,
tison.
Enrico Olivelli <eolivelli@gmail.com> 于2019年9月24日周二 下午8:06写道:
> Zili,
> Sessions expire in the server. If you are not connected to the cluster you
> cannot assume that the session is expired.
>
> There is another weird edge case: if the server/cluster is down the session
> cannot expire.
>
> Hope that helps
> Enrico
>
> Il mar 24 set 2019, 13:54 Zili Chen <wander4096@gmail.com> ha scritto:
>
> > Hi ZooKeepers,
> >
> > I want to trace where Watcher.Event.KeeperState.Expired generated and it
> > seems only generated
> > when connect to server fails due to exceed session timeout.
> >
> > Besides, I find code snippet in ClientCnxn as below
> >
> > void queueEvent(String clientPath, int err, Set<Watcher>
> > materializedWatchers, EventType eventType) {
> > KeeperState sessionState = KeeperState.SyncConnected;
> > if (KeeperException.Code.SESSIONEXPIRED.intValue() == err
> > || KeeperException.Code.CONNECTIONLOSS.intValue() == err) {
> > sessionState = Event.KeeperState.Disconnected;
> > }
> > WatchedEvent event = new WatchedEvent(eventType, sessionState,
> > clientPath);
> > eventThread.queueEvent(event, materializedWatchers);
> > }
> >
> > which seems a bit wried to me what we queue
> > a Event.KeeperState.Disconnected on
> > KeeperException.Code.SESSIONEXPIRED.
> >
> > Back to the question, how zookeeper discovers and triggers session expire
> > event on
> > session expired after connection established successfully?
> >
> > Best,
> > tison.
> >
>
|