diff --git a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java index 641542038a4..2f9a3248b6b 100644 --- a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java +++ b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java @@ -33,7 +33,6 @@ import org.apache.solr.common.params.CoreAdminParams.CoreAdminAction; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.util.NamedList; -import org.apache.solr.common.util.SuppressForbidden; import org.apache.solr.core.CoreContainer; import org.apache.solr.core.CoreDescriptor; import org.apache.solr.core.SolrCore; @@ -346,39 +345,37 @@ public void requestRecoveries() { } } - @SuppressForbidden(reason = "Passed to an executor with a naming thread factory") private void requestRecovery( final ZkNodeProps leaderProps, final String baseUrl, final String coreName) throws SolrServerException, IOException { - Thread thread = - new Thread( - () -> { - if (isClosed) { - log.info("We have been closed, won't request recovery"); - return; - } - RequestRecovery recoverRequestCmd = new RequestRecovery(); - recoverRequestCmd.setAction(CoreAdminAction.REQUESTRECOVERY); - recoverRequestCmd.setCoreName(coreName); - try (SolrClient client = - new Http2SolrClient.Builder(baseUrl) - .withHttpClient(solrClient) - .withConnectionTimeout(30000, TimeUnit.MILLISECONDS) - .withIdleTimeout(120000, TimeUnit.MILLISECONDS) - .build()) { - client.request(recoverRequestCmd); - } catch (Throwable t) { - log.error( - "{}: Could not tell a replica to recover", - ZkCoreNodeProps.getCoreUrl(leaderProps), - t); - if (t instanceof Error) { - throw (Error) t; - } - } - }); - thread.setDaemon(true); - updateExecutor.execute(thread); + Runnable runnable = + () -> { + if (isClosed) { + log.info("We have been closed, won't request recovery"); + return; + } + RequestRecovery recoverRequestCmd = new RequestRecovery(); + recoverRequestCmd.setAction(CoreAdminAction.REQUESTRECOVERY); + recoverRequestCmd.setCoreName(coreName); + try (SolrClient client = + new Http2SolrClient.Builder(baseUrl) + .withHttpClient(solrClient) + .withConnectionTimeout(30000, TimeUnit.MILLISECONDS) + .withIdleTimeout(120000, TimeUnit.MILLISECONDS) + .build()) { + client.request(recoverRequestCmd); + } catch (Throwable t) { + log.error( + "{}: Could not tell a replica to recover", + ZkCoreNodeProps.getCoreUrl(leaderProps), + t); + if (t instanceof Error) { + throw (Error) t; + } + } + }; + + updateExecutor.execute(runnable); } public static ModifiableSolrParams params(String... params) {