Skip to content

Commit a2710e4

Browse files
try-with-resource
1 parent 322c6c0 commit a2710e4

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

server/src/main/java/org/elasticsearch/index/engine/ThreadPoolMergeExecutorService.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ private boolean enqueueMergeTaskExecution() {
317317
// is also drained, so any queued merge tasks are also forgotten.
318318
break;
319319
}
320-
try {
320+
try (var ignored = smallestMergeTaskWithReleasableBudget) {
321321
MergeTask smallestMergeTask = smallestMergeTaskWithReleasableBudget.element();
322322
// let the task's scheduler decide if it can actually run the merge task now
323323
ThreadPoolMergeScheduler.Schedule schedule = smallestMergeTask.schedule();
@@ -335,10 +335,6 @@ private boolean enqueueMergeTaskExecution() {
335335
// task is re-enqueued and re-took before the budget hold-up here is released upon the next
336336
// {@link PriorityBlockingQueueWithBudget#updateBudget} invocation.
337337
}
338-
} finally {
339-
// signals that the merge task is not in use anymore, so the budget (i.e. disk space) it's holding so far won't be
340-
// deducted from the total available
341-
smallestMergeTaskWithReleasableBudget.close();
342338
}
343339
}
344340
});

0 commit comments

Comments
 (0)