Skip to content

Commit

Permalink
last review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
javanna committed Oct 24, 2017
1 parent 0f80937 commit 9de40e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -715,18 +715,18 @@ private static boolean awaitTermination(
* Returns <code>true</code> if the given pool was terminated successfully. If the termination timed out,
* the service is <code>null</code> this method will return <code>false</code>.
*/
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;
Expand Down

0 comments on commit 9de40e1

Please sign in to comment.