Database Reference
In-Depth Information
relinquish leadership (if it had it) and inform the server that the
connection has been lost. This is handled by the process method:
public void process(WatchedEvent event) {
if (event.getType() ==
Watcher.Event.EventType. None ) {
switch (event.getState()) {
case SyncConnected :
connected = true ;
try {
requestLeadership();
} catch (Exception e) {
//Quit
synchronized (lock) {
leader = false ;
lock.notify();
}
}
break ;
case Expired :
case Disconnected :
synchronized (lock) {
connected = false ;
leader = false ;
lock.notify();
}
break ;
default :
break ;
}
} else {
if (path.equals(event.getPath()))
client.getChildren(path, true , this , null );
}
}
Search WWH ::




Custom Search