diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java index f6ce24ec48fb2..e36c445082ed6 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java @@ -615,7 +615,7 @@ public void afterBulk(long executionId, BulkRequest request, Throwable failure) // Pull the client to a variable to work around https://bugs.eclipse.org/bugs/show_bug.cgi?id=514884 RestHighLevelClient hlClient = highLevelClient(); - try(BulkProcessor processor = BulkProcessor.builder(hlClient::bulkAsync, listener) + try (BulkProcessor processor = BulkProcessor.builder(hlClient::bulkAsync, listener) .setConcurrentRequests(0) .setBulkSize(new ByteSizeValue(5, ByteSizeUnit.GB)) .setBulkActions(nbItems + 1) diff --git a/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java b/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java index 1098cdc0b4b04..86afcc312860f 100644 --- a/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java +++ b/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java @@ -715,18 +715,18 @@ private static boolean awaitTermination( * Returns true if the given pool was terminated successfully. If the termination timed out, * the service is null this method will return false. */ - public static boolean terminate(ThreadPool threadPool, long timeout, TimeUnit timeUnit) { - if (threadPool != null) { + public static boolean terminate(ThreadPool pool, long timeout, TimeUnit timeUnit) { + if (pool != null) { try { - threadPool.shutdown(); - if (awaitTermination(threadPool, timeout, timeUnit)) { + pool.shutdown(); + if (awaitTermination(pool, timeout, timeUnit)) { return true; } // last resort - threadPool.shutdownNow(); - return awaitTermination(threadPool, timeout, timeUnit); + pool.shutdownNow(); + return awaitTermination(pool, timeout, timeUnit); } finally { - IOUtils.closeWhileHandlingException(threadPool); + IOUtils.closeWhileHandlingException(pool); } } return false;