Skip to content

Commit d537a1f

Browse files
Remove redundant LatchedActionListener from ESIntegTestCase (#121244)
This is effectively the same as the other class. The logging is irrelevant and the dead `addError` is too => lets remove this.
1 parent fc500d1 commit d537a1f

File tree

1 file changed

+6
-30
lines changed

1 file changed

+6
-30
lines changed

test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.elasticsearch.action.ActionResponse;
2727
import org.elasticsearch.action.ActionType;
2828
import org.elasticsearch.action.DocWriteResponse;
29+
import org.elasticsearch.action.LatchedActionListener;
2930
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest;
3031
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
3132
import org.elasticsearch.action.admin.cluster.allocation.TransportClusterAllocationExplainAction;
@@ -1753,7 +1754,8 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma
17531754
logger.info("Index [{}] docs async: [{}] bulk: [{}]", builders.size(), true, false);
17541755
for (IndexRequestBuilder indexRequestBuilder : builders) {
17551756
indexRequestBuilder.execute(
1756-
new LatchedActionListener<DocWriteResponse>(newLatch(inFlightAsyncOperations)).delegateResponse((l, e) -> fail(e))
1757+
new LatchedActionListener<DocWriteResponse>(ActionListener.noop(), newLatch(inFlightAsyncOperations))
1758+
.delegateResponse((l, e) -> fail(e))
17571759
);
17581760
postIndexAsyncActions(indicesArray, inFlightAsyncOperations, maybeFlush);
17591761
}
@@ -1845,17 +1847,17 @@ private void postIndexAsyncActions(String[] indices, List<CountDownLatch> inFlig
18451847
if (rarely()) {
18461848
indicesAdmin().prepareRefresh(indices)
18471849
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
1848-
.execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
1850+
.execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations)));
18491851
} else if (maybeFlush && rarely()) {
18501852
indicesAdmin().prepareFlush(indices)
18511853
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
1852-
.execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
1854+
.execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations)));
18531855
} else if (rarely()) {
18541856
indicesAdmin().prepareForceMerge(indices)
18551857
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
18561858
.setMaxNumSegments(between(1, 10))
18571859
.setFlush(maybeFlush && randomBoolean())
1858-
.execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
1860+
.execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations)));
18591861
}
18601862
}
18611863
while (inFlightAsyncOperations.size() > MAX_IN_FLIGHT_ASYNC_INDEXES) {
@@ -1939,32 +1941,6 @@ public enum Scope {
19391941
int numClientNodes() default InternalTestCluster.DEFAULT_NUM_CLIENT_NODES;
19401942
}
19411943

1942-
private class LatchedActionListener<Response> implements ActionListener<Response> {
1943-
private final CountDownLatch latch;
1944-
1945-
LatchedActionListener(CountDownLatch latch) {
1946-
this.latch = latch;
1947-
}
1948-
1949-
@Override
1950-
public final void onResponse(Response response) {
1951-
latch.countDown();
1952-
}
1953-
1954-
@Override
1955-
public final void onFailure(Exception t) {
1956-
try {
1957-
logger.info("Action Failed", t);
1958-
addError(t);
1959-
} finally {
1960-
latch.countDown();
1961-
}
1962-
}
1963-
1964-
protected void addError(Exception e) {}
1965-
1966-
}
1967-
19681944
/**
19691945
* Clears the given scroll Ids
19701946
*/

0 commit comments

Comments
 (0)