From 5d2de95e35961b14de74de6cf1a9615595fe8ff6 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Wed, 1 Feb 2012 15:52:10 +0000 Subject: [PATCH] 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 --- .../java/org/apache/solr/cloud/Overseer.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cloud/Overseer.java b/solr/core/src/java/org/apache/solr/cloud/Overseer.java index 9264b14e384..7d9e51c24ce 100644 --- a/solr/core/src/java/org/apache/solr/cloud/Overseer.java +++ b/solr/core/src/java/org/apache/solr/cloud/Overseer.java @@ -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;