Skip to content

Commit 0ecc72a

Browse files
author
Vincent Potucek
committed
S1144: Unused "private" methods should be removed
Signed-off-by: Vincent Potucek <[email protected]>
1 parent a033cd1 commit 0ecc72a

File tree

36 files changed

+1
-580
lines changed

36 files changed

+1
-580
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3333
- Grant access to testclusters dir for tests ([#19085](https://github.com/opensearch-project/OpenSearch/issues/19085))
3434
- Fix assertion error when collapsing search results with concurrent segment search enabled ([#19053](https://github.com/opensearch-project/OpenSearch/pull/19053))
3535
- Fix skip_unavailable setting changing to default during node drop issue ([#18766](https://github.com/opensearch-project/OpenSearch/pull/18766))
36+
- S1144: Unused "private" methods should be removed ([#18918](https://github.com/opensearch-project/OpenSearch/pull/18918))
3637

3738
### Dependencies
3839
- Bump `com.netflix.nebula.ospackage-base` from 12.0.0 to 12.1.0 ([#19019](https://github.com/opensearch-project/OpenSearch/pull/19019))

libs/task-commons/src/main/java/org/opensearch/task/commons/clients/TaskListRequest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,6 @@ public TaskListRequest taskType(TaskStatus... taskStatus) {
7171
return this;
7272
}
7373

74-
/**
75-
* Update worker node to filter with in the request
76-
* @param workerNode WorkerNode
77-
* @return ListTaskRequest
78-
*/
79-
private TaskListRequest workerNode(WorkerNode workerNode) {
80-
this.workerNodes = workerNode;
81-
return this;
82-
}
83-
8474
/**
8575
* Update page number to start with when fetching the list of tasks
8676
* @param startPageNumber startPageNumber

modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCacheTests.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,17 +2665,6 @@ private TieredSpilloverCache<String, String> getTieredSpilloverCache(
26652665
return builder.build();
26662666
}
26672667

2668-
private TieredSpilloverCache<String, String> initializeTieredSpilloverCache(
2669-
int keyValueSize,
2670-
int diskCacheSize,
2671-
RemovalListener<ICacheKey<String>, String> removalListener,
2672-
Settings settings,
2673-
long diskDeliberateDelay
2674-
2675-
) {
2676-
return initializeTieredSpilloverCache(keyValueSize, diskCacheSize, removalListener, settings, diskDeliberateDelay, null, 256);
2677-
}
2678-
26792668
private TieredSpilloverCache<String, String> initializeTieredSpilloverCache(
26802669
int keyValueSize,
26812670
int diskCacheSize,

plugins/arrow-flight-rpc/src/internalClusterTest/java/org/opensearch/arrow/flight/chaos/ChaosAgent.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import javassist.ClassPool;
1515
import javassist.CtClass;
1616
import javassist.CtConstructor;
17-
import javassist.CtMethod;
1817

1918
/**
2019
* Java agent for bytecode injection of chaos testing
@@ -75,27 +74,6 @@ private boolean shouldTransform(String className) {
7574
return className.startsWith("org/opensearch/arrow/flight/transport/Flight");
7675
}
7776

78-
private void transformFlightTransport(CtClass ctClass) throws Exception {
79-
CtMethod method = ctClass.getDeclaredMethod("openConnection");
80-
method.insertBefore("org.opensearch.arrow.flight.chaos.ChaosScenario.injectChaos();");
81-
}
82-
83-
private void transformFlightTransportChannel(CtClass ctClass) throws Exception {
84-
CtMethod sendBatch = ctClass.getDeclaredMethod("sendResponseBatch");
85-
sendBatch.insertBefore("org.opensearch.arrow.flight.chaos.ChaosScenario.injectChaos();");
86-
87-
CtMethod complete = ctClass.getDeclaredMethod("completeStream");
88-
complete.insertBefore("org.opensearch.arrow.flight.chaos.ChaosScenario.injectChaos();");
89-
}
90-
91-
private void transformFlightTransportResponse(CtClass ctClass) throws Exception {
92-
CtMethod nextResponse = ctClass.getDeclaredMethod("nextResponse");
93-
nextResponse.insertBefore("org.opensearch.arrow.flight.chaos.ChaosScenario.injectChaos();");
94-
95-
// CtMethod close = ctClass.getDeclaredMethod("close");
96-
// close.insertBefore("org.opensearch.arrow.flight.chaos.ChaosInterceptor.beforeResponseClose();");
97-
}
98-
9977
private void transformFlightServerChannelWithDelay(CtClass ctClass) throws Exception {
10078
CtConstructor[] ctr = ctClass.getConstructors();
10179
ctr[0].insertBefore("org.opensearch.arrow.flight.chaos.ChaosScenario.injectChaos();");

plugins/arrow-flight-rpc/src/internalClusterTest/java/org/opensearch/arrow/flight/chaos/ChaosScenario.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
package org.opensearch.arrow.flight.chaos;
1010

11-
import org.opensearch.transport.stream.StreamErrorCode;
1211
import org.opensearch.transport.stream.StreamException;
1312

1413
import java.util.concurrent.atomic.AtomicBoolean;
@@ -67,20 +66,6 @@ public static void injectChaos() throws StreamException {
6766
}
6867
}
6968

70-
private static void simulateUnresponsiveness() throws StreamException {
71-
try {
72-
Thread.sleep(timeoutDelayMs);
73-
} catch (InterruptedException e) {
74-
Thread.currentThread().interrupt();
75-
}
76-
throw new StreamException(StreamErrorCode.TIMED_OUT, "Client unresponsive");
77-
}
78-
79-
private static void simulateClientNodeDeath() throws StreamException {
80-
// Simulate node death followed by recovery
81-
throw new StreamException(StreamErrorCode.UNAVAILABLE, "Client node death - connection lost");
82-
}
83-
8469
private static void simulateLongRunningOperation() throws StreamException {
8570
try {
8671
Thread.sleep(timeoutDelayMs);

plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/FlightClientManager.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import java.util.Map;
3636
import java.util.Objects;
3737
import java.util.Optional;
38-
import java.util.Set;
3938
import java.util.concurrent.CompletableFuture;
4039
import java.util.concurrent.ConcurrentHashMap;
4140
import java.util.concurrent.ExecutorService;
@@ -247,10 +246,6 @@ private static boolean isValidNode(DiscoveryNode node) {
247246
return node != null && !node.getVersion().before(MIN_SUPPORTED_VERSION) && FeatureFlags.isEnabled(ARROW_STREAMS_SETTING);
248247
}
249248

250-
private Set<String> getCurrentClusterNodes() {
251-
return Objects.requireNonNull(clientConfig.clusterService).state().nodes().getNodes().keySet();
252-
}
253-
254249
@VisibleForTesting
255250
Map<String, ClientHolder> getFlightClients() {
256251
return flightClients;

plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,35 +1264,6 @@ PersistentCacheManager buildCacheManager() {
12641264
}
12651265
}
12661266

1267-
private EhcacheDiskCache.Builder<String, String> createDummyBuilder(String storagePath) throws IOException {
1268-
Settings settings = Settings.builder().build();
1269-
MockRemovalListener<String, String> removalListener = new MockRemovalListener<>();
1270-
ToLongBiFunction<ICacheKey<String>, String> weigher = getWeigher();
1271-
try (NodeEnvironment env = newNodeEnvironment(settings)) {
1272-
if (storagePath == null || storagePath.isBlank()) {
1273-
storagePath = env.nodePaths()[0].path.toString() + "/request_cache";
1274-
}
1275-
return (EhcacheDiskCache.Builder<String, String>) new EhcacheDiskCache.Builder<String, String>().setThreadPoolAlias(
1276-
"ehcacheTest"
1277-
)
1278-
.setIsEventListenerModeSync(true)
1279-
.setStoragePath(storagePath)
1280-
.setKeyType(String.class)
1281-
.setValueType(String.class)
1282-
.setKeySerializer(new StringSerializer())
1283-
.setDiskCacheAlias("test1")
1284-
.setValueSerializer(new StringSerializer())
1285-
.setDimensionNames(List.of(dimensionName))
1286-
.setCacheType(CacheType.INDICES_REQUEST_CACHE)
1287-
.setSettings(settings)
1288-
.setExpireAfterAccess(TimeValue.MAX_VALUE)
1289-
.setMaximumWeightInBytes(CACHE_SIZE_IN_BYTES)
1290-
.setRemovalListener(removalListener)
1291-
.setWeigher(weigher)
1292-
.setStatsTrackingEnabled(false);
1293-
}
1294-
}
1295-
12961267
private List<String> getRandomDimensions(List<String> dimensionNames) {
12971268
Random rand = Randomness.get();
12981269
int bound = 3;

server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderIT.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,6 @@ public void testDiskMonitorResetLastRuntimeMilliSecOnlyInFirstCall() throws Exce
503503
}, 30L, TimeUnit.SECONDS);
504504
}
505505

506-
private String populateNode(final String dataNodeName) throws Exception {
507-
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
508-
createAndPopulateIndex(indexName, dataNodeName);
509-
return indexName;
510-
}
511-
512506
private void createIndex(String indexName, String nodeName, boolean isWarmIndex) throws Exception {
513507
final Settings.Builder indexSettingBuilder = Settings.builder()
514508
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)

server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreClusterStateRestoreIT.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ protected Settings nodeSettings(int nodeOrdinal) {
8383
return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(REMOTE_CLUSTER_STATE_ENABLED_SETTING.getKey(), true).build();
8484
}
8585

86-
private void addNewNodes(int dataNodeCount, int clusterManagerNodeCount) {
87-
internalCluster().startNodes(dataNodeCount + clusterManagerNodeCount);
88-
}
89-
9086
private Map<String, Long> initialTestSetup(int shardCount, int replicaCount, int dataNodeCount, int clusterManagerNodeCount) {
9187
prepareCluster(clusterManagerNodeCount, dataNodeCount, INDEX_NAME, replicaCount, shardCount);
9288
Map<String, Long> indexStats = indexData(1, false, INDEX_NAME);

server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoRequest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,6 @@ public NodesInfoRequest removeMetric(String metric) {
146146
return this;
147147
}
148148

149-
/**
150-
* Helper method for adding and removing metrics. Used when deserializing
151-
* a NodesInfoRequest from an ordered list of booleans.
152-
*
153-
* @param addMetric Whether or not to include a metric.
154-
* @param metricName Name of the metric to include or remove.
155-
*/
156-
private void optionallyAddMetric(boolean addMetric, String metricName) {
157-
if (addMetric) {
158-
requestedMetrics.add(metricName);
159-
}
160-
}
161-
162149
@Override
163150
public void writeTo(StreamOutput out) throws IOException {
164151
super.writeTo(out);

0 commit comments

Comments
 (0)