SOLR-10397: Break on interruption and always throw KeeperException on read otherwise trigger thread cannot function

This commit is contained in:
Shalin Shekhar Mangar 2017-09-19 11:34:53 -07:00
parent 61fe5248b0
commit bb408c35a1
1 changed files with 3 additions and 6 deletions

View File

@ -125,12 +125,13 @@ public class OverseerTriggerThread implements Runnable, Closeable {
// Restore the interrupted status
Thread.currentThread().interrupt();
log.warn("Interrupted", e);
break;
} catch (KeeperException e) {
log.error("A ZK error has occurred", e);
}
}
if (!isClosed || Thread.currentThread().isInterrupted()) return;
if (isClosed || Thread.currentThread().isInterrupted()) return;
try {
refreshAutoScalingConf(new AutoScalingWatcher());
@ -138,11 +139,7 @@ public class OverseerTriggerThread implements Runnable, Closeable {
log.warn("ZooKeeper watch triggered for autoscaling conf, but Solr cannot talk to ZK: [{}]", e.getMessage());
} catch (KeeperException e) {
log.error("A ZK error has occurred", e);
if (!isClosed) {
// throw exception only if we haven't been closed already
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
}
return; // silently!
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
} catch (InterruptedException e) {
// Restore the interrupted status
Thread.currentThread().interrupt();