From 608c8ae5fce90359010da04253b0ebf19efb0740 Mon Sep 17 00:00:00 2001 From: Aman Khare Date: Fri, 23 Feb 2024 18:21:18 +0530 Subject: [PATCH] spotless apply Signed-off-by: Aman Khare --- .../opensearch/gateway/AsyncShardFetch.java | 11 +-------- .../opensearch/gateway/BaseShardCache.java | 24 +++++-------------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/server/src/main/java/org/opensearch/gateway/AsyncShardFetch.java b/server/src/main/java/org/opensearch/gateway/AsyncShardFetch.java index 4de8447f07421..5ad55db7ac571 100644 --- a/server/src/main/java/org/opensearch/gateway/AsyncShardFetch.java +++ b/server/src/main/java/org/opensearch/gateway/AsyncShardFetch.java @@ -32,27 +32,20 @@ package org.opensearch.gateway; import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.message.ParameterizedMessage; -import org.opensearch.ExceptionsHelper; -import org.opensearch.OpenSearchTimeoutException; import org.opensearch.action.FailedNodeException; import org.opensearch.action.support.nodes.BaseNodeResponse; import org.opensearch.action.support.nodes.BaseNodesResponse; import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.cluster.node.DiscoveryNodes; import org.opensearch.cluster.routing.allocation.RoutingAllocation; -import org.opensearch.common.Nullable; import org.opensearch.common.lease.Releasable; import org.opensearch.core.action.ActionListener; -import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException; import org.opensearch.core.index.shard.ShardId; import org.opensearch.indices.store.ShardAttributes; -import org.opensearch.transport.ReceiveTimeoutTransportException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -183,9 +176,7 @@ public synchronized FetchResult fetchData(DiscoveryNodes nodes, Map populateCache(DiscoveryNodes nodes, Set failedNodes) { Map fetchData = new HashMap<>(); - for (Iterator> it = getCache().entrySet().iterator(); it.hasNext(); ) { + for (Iterator> it = getCache().entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); String nodeId = entry.getKey(); BaseNodeEntry nodeEntry = entry.getValue(); @@ -170,8 +171,7 @@ public void processResponses(List responses, long fetchingRound) { if (nodeEntry != null) { if (validateNodeResponse(nodeEntry, fetchingRound)) { // if the entry is there, for the right fetching round and not marked as failed already, process it - logger.trace("{} marking {} as done for [{}], result is [{}]", logKey, nodeEntry.getNodeId(), type, - response); + logger.trace("{} marking {} as done for [{}], result is [{}]", logKey, nodeEntry.getNodeId(), type, response); putData(response.getNode(), response); } } @@ -191,13 +191,7 @@ public boolean validateNodeResponse(BaseNodeEntry nodeEntry, long fetchingRound) ); return false; } else if (nodeEntry.isFailed()) { - logger.trace( - "{} node {} has failed for [{}] (failure [{}])", - logKey, - nodeEntry.getNodeId(), - type, - nodeEntry.getFailure() - ); + logger.trace("{} node {} has failed for [{}] (failure [{}])", logKey, nodeEntry.getNodeId(), type, nodeEntry.getFailure()); return false; } return true; @@ -224,12 +218,7 @@ public void handleNodeFailure(BaseNodeEntry nodeEntry, FailedNodeException failu nodeEntry.restartFetching(); } else { logger.warn( - () -> new ParameterizedMessage( - "{}: failed to list shard for {} on node [{}]", - logKey, - type, - failure.nodeId() - ), + () -> new ParameterizedMessage("{}: failed to list shard for {} on node [{}]", logKey, type, failure.nodeId()), failure ); nodeEntry.doneFetching(failure.getCause()); @@ -257,7 +246,6 @@ public void markAsFetching(List nodeIds, long fetchingRound) { } } - /** * A node entry, holding only node level fetching related information. * Actual metadata of shard is stored in child classes.