private void onShardOperation( final NodeRequest request, final Object[] shardResults, final int shardIndex, final ShardRouting shardRouting) { try { logger.trace( "[{}] executing operation for shard [{}]", actionName, shardRouting.shortSummary()); ShardOperationResult result = shardOperation(request.indicesLevelRequest, shardRouting); shardResults[shardIndex] = result; logger.trace( "[{}] completed operation for shard [{}]", actionName, shardRouting.shortSummary()); } catch (Throwable t) { BroadcastShardOperationFailedException e = new BroadcastShardOperationFailedException( shardRouting.shardId(), "operation " + actionName + " failed", t); e.setIndex(shardRouting.getIndex()); e.setShard(shardRouting.shardId()); shardResults[shardIndex] = e; logger.debug( "[{}] failed to execute operation for shard [{}]", e, actionName, shardRouting.shortSummary()); } }