SOLR-3065: clean up exception handling / logging

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1239180 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-02-01 15:52:10 +00:00
parent 8e357cac55
commit 5d2de95e35
1 changed files with 12 additions and 6 deletions

View File

@ -144,10 +144,16 @@ public class Overseer implements NodeStateChangeListener, ShardLeaderListener {
ZkStateReader.toJSON(cloudState), true);
} catch (KeeperException e) {
// XXX stop processing, exit
return;
if (e.code() == KeeperException.Code.SESSIONEXPIRED
|| e.code() == KeeperException.Code.CONNECTIONLOSS) {
log.warn("ZooKeeper watch triggered, but Solr cannot talk to ZK");
return;
}
SolrException.log(log, "", e);
throw new ZooKeeperException(
SolrException.ErrorCode.SERVER_ERROR, "", e);
} catch (InterruptedException e) {
// XXX stop processing, exit
Thread.currentThread().interrupt();
return;
}
}
@ -156,7 +162,7 @@ public class Overseer implements NodeStateChangeListener, ShardLeaderListener {
try {
Thread.sleep(STATE_UPDATE_DELAY);
} catch (InterruptedException e) {
//
Thread.currentThread().interrupt();
}
}
}
@ -168,9 +174,9 @@ public class Overseer implements NodeStateChangeListener, ShardLeaderListener {
return true;
}
} catch (KeeperException e) {
// assume we're dead
log.warn("", e);
} catch (InterruptedException e) {
// assume we're dead
Thread.currentThread().interrupt();
}
log.info("According to ZK I (id=" + myId + ") am no longer a leader.");
return false;