|
33 | 33 | import org.apache.solr.common.params.CoreAdminParams.CoreAdminAction; |
34 | 34 | import org.apache.solr.common.params.ModifiableSolrParams; |
35 | 35 | import org.apache.solr.common.util.NamedList; |
36 | | -import org.apache.solr.common.util.SuppressForbidden; |
37 | 36 | import org.apache.solr.core.CoreContainer; |
38 | 37 | import org.apache.solr.core.CoreDescriptor; |
39 | 38 | import org.apache.solr.core.SolrCore; |
@@ -346,39 +345,37 @@ public void requestRecoveries() { |
346 | 345 | } |
347 | 346 | } |
348 | 347 |
|
349 | | - @SuppressForbidden(reason = "Passed to an executor with a naming thread factory") |
350 | 348 | private void requestRecovery( |
351 | 349 | final ZkNodeProps leaderProps, final String baseUrl, final String coreName) |
352 | 350 | throws SolrServerException, IOException { |
353 | | - Thread thread = |
354 | | - new Thread( |
355 | | - () -> { |
356 | | - if (isClosed) { |
357 | | - log.info("We have been closed, won't request recovery"); |
358 | | - return; |
359 | | - } |
360 | | - RequestRecovery recoverRequestCmd = new RequestRecovery(); |
361 | | - recoverRequestCmd.setAction(CoreAdminAction.REQUESTRECOVERY); |
362 | | - recoverRequestCmd.setCoreName(coreName); |
363 | | - try (SolrClient client = |
364 | | - new Http2SolrClient.Builder(baseUrl) |
365 | | - .withHttpClient(solrClient) |
366 | | - .withConnectionTimeout(30000, TimeUnit.MILLISECONDS) |
367 | | - .withIdleTimeout(120000, TimeUnit.MILLISECONDS) |
368 | | - .build()) { |
369 | | - client.request(recoverRequestCmd); |
370 | | - } catch (Throwable t) { |
371 | | - log.error( |
372 | | - "{}: Could not tell a replica to recover", |
373 | | - ZkCoreNodeProps.getCoreUrl(leaderProps), |
374 | | - t); |
375 | | - if (t instanceof Error) { |
376 | | - throw (Error) t; |
377 | | - } |
378 | | - } |
379 | | - }); |
380 | | - thread.setDaemon(true); |
381 | | - updateExecutor.execute(thread); |
| 351 | + Runnable runnable = |
| 352 | + () -> { |
| 353 | + if (isClosed) { |
| 354 | + log.info("We have been closed, won't request recovery"); |
| 355 | + return; |
| 356 | + } |
| 357 | + RequestRecovery recoverRequestCmd = new RequestRecovery(); |
| 358 | + recoverRequestCmd.setAction(CoreAdminAction.REQUESTRECOVERY); |
| 359 | + recoverRequestCmd.setCoreName(coreName); |
| 360 | + try (SolrClient client = |
| 361 | + new Http2SolrClient.Builder(baseUrl) |
| 362 | + .withHttpClient(solrClient) |
| 363 | + .withConnectionTimeout(30000, TimeUnit.MILLISECONDS) |
| 364 | + .withIdleTimeout(120000, TimeUnit.MILLISECONDS) |
| 365 | + .build()) { |
| 366 | + client.request(recoverRequestCmd); |
| 367 | + } catch (Throwable t) { |
| 368 | + log.error( |
| 369 | + "{}: Could not tell a replica to recover", |
| 370 | + ZkCoreNodeProps.getCoreUrl(leaderProps), |
| 371 | + t); |
| 372 | + if (t instanceof Error) { |
| 373 | + throw (Error) t; |
| 374 | + } |
| 375 | + } |
| 376 | + }; |
| 377 | + |
| 378 | + updateExecutor.execute(runnable); |
382 | 379 | } |
383 | 380 |
|
384 | 381 | public static ModifiableSolrParams params(String... params) { |
|
0 commit comments