diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java index 80e50e8642c94..c8c76192b281f 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java @@ -70,13 +70,13 @@ protected ForceMergeRequest readRequestFrom(StreamInput in) throws IOException { @Override protected void shardOperation(ForceMergeRequest request, ShardRouting shardRouting, Task task, ActionListener listener) { - threadPool.executor(ThreadPool.Names.FORCE_MERGE).execute(ActionRunnable.run(listener, + assert (task instanceof CancellableTask) == false; // TODO: add cancellation handling here once the task supports it + threadPool.executor(ThreadPool.Names.FORCE_MERGE).execute(ActionRunnable.supply(listener, () -> { - assert (task instanceof CancellableTask) == false; // TODO: add cancellation handling here once the task supports it IndexShard indexShard = indicesService.indexServiceSafe(shardRouting.shardId().getIndex()) .getShard(shardRouting.shardId().id()); indexShard.forceMerge(request); - listener.onResponse(EmptyResult.INSTANCE); + return EmptyResult.INSTANCE; })); }