From ccd0543172da4cb4883807c58bb5fae57de3dd39 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Tue, 8 Dec 2015 16:48:00 +0100 Subject: [PATCH] CancellableThreads should also treat ThreadInterruptedException as InterruptedException RecoverySource uses the RateLimiter under a cancelable thread. The SimpleRateLimiter used in throws ThreadInterruptedException on interruption. We should treat it as InterruptedException --- .../java/org/elasticsearch/common/util/CancellableThreads.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/common/util/CancellableThreads.java b/core/src/main/java/org/elasticsearch/common/util/CancellableThreads.java index b8c5ba09b9c..a605d66e80d 100644 --- a/core/src/main/java/org/elasticsearch/common/util/CancellableThreads.java +++ b/core/src/main/java/org/elasticsearch/common/util/CancellableThreads.java @@ -18,6 +18,7 @@ */ package org.elasticsearch.common.util; +import org.apache.lucene.util.ThreadInterruptedException; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.common.Nullable; @@ -84,7 +85,7 @@ public class CancellableThreads { RuntimeException throwable = null; try { interruptable.run(); - } catch (InterruptedException e) { + } catch (InterruptedException | ThreadInterruptedException e) { // assume this is us and ignore } catch (RuntimeException t) { throwable = t;