Apache Lucene open-source search software
SOLR-11557: SolrZkClient.checkInterrupted interrupts current thread
Tomas Fernandez Lobbe03084fa754a7
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 20bf8374d82..a5e48ace9d0 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -79,6 +79,8 @@ Bug Fixes* SOLR-11532: Solr hits NPE when fl only contains DV fields and any of them is a spatial field. (Cao Manh Dat, David Smiley)+* SOLR-11557: Fix SolrZkClient.checkInterrupted (Tomás Fernández Löbbe)+Optimizations----------------------* SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solrdiff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.javaindex 539c2900cf9..d502bf6ab28 100644--- a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java@@ -697,7 +697,7 @@ public class SolrZkClient implements Closeable {*/public static Throwable checkInterrupted(Throwable e) {if (e instanceof InterruptedException)- Thread.interrupted();+ Thread.currentThread().interrupt();return e;}diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/SolrZkClientTest.java b/solr/solrj/src/test/org/apache/solr/common/cloud/SolrZkClientTest.javaindex ab99cc008e1..126d35b5dcd 100644--- a/solr/solrj/src/test/org/apache/solr/common/cloud/SolrZkClientTest.java+++ b/solr/solrj/src/test/org/apache/solr/common/cloud/SolrZkClientTest.java@@ -139,4 +139,15 @@ public class SolrZkClientTest extends SolrTestCaseJ4 {return false;}}++ @Test+ public void testCheckInterrupted() {+ assertFalse(Thread.currentThread().isInterrupted());+ SolrZkClient.checkInterrupted(new RuntimeException());+ assertFalse(Thread.currentThread().isInterrupted());+ SolrZkClient.checkInterrupted(new InterruptedException());+ assertTrue(Thread.currentThread().isInterrupted());+ }++}