Skip to content

Commit 1261557

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

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;
@@ -1711,7 +1712,8 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma
17111712
logger.info("Index [{}] docs async: [{}] bulk: [{}]", builders.size(), true, false);
17121713
for (IndexRequestBuilder indexRequestBuilder : builders) {
17131714
indexRequestBuilder.execute(
1714-
new LatchedActionListener<DocWriteResponse>(newLatch(inFlightAsyncOperations)).delegateResponse((l, e) -> fail(e))
1715+
new LatchedActionListener<DocWriteResponse>(ActionListener.noop(), newLatch(inFlightAsyncOperations))
1716+
.delegateResponse((l, e) -> fail(e))
17151717
);
17161718
postIndexAsyncActions(indicesArray, inFlightAsyncOperations, maybeFlush);
17171719
}
@@ -1803,17 +1805,17 @@ private void postIndexAsyncActions(String[] indices, List<CountDownLatch> inFlig
18031805
if (rarely()) {
18041806
indicesAdmin().prepareRefresh(indices)
18051807
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
1806-
.execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
1808+
.execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations)));
18071809
} else if (maybeFlush && rarely()) {
18081810
indicesAdmin().prepareFlush(indices)
18091811
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
1810-
.execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
1812+
.execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations)));
18111813
} else if (rarely()) {
18121814
indicesAdmin().prepareForceMerge(indices)
18131815
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
18141816
.setMaxNumSegments(between(1, 10))
18151817
.setFlush(maybeFlush && randomBoolean())
1816-
.execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
1818+
.execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations)));
18171819
}
18181820
}
18191821
while (inFlightAsyncOperations.size() > MAX_IN_FLIGHT_ASYNC_INDEXES) {
@@ -1897,32 +1899,6 @@ public enum Scope {
18971899
int numClientNodes() default InternalTestCluster.DEFAULT_NUM_CLIENT_NODES;
18981900
}
18991901

1900-
private class LatchedActionListener<Response> implements ActionListener<Response> {
1901-
private final CountDownLatch latch;
1902-
1903-
LatchedActionListener(CountDownLatch latch) {
1904-
this.latch = latch;
1905-
}
1906-
1907-
@Override
1908-
public final void onResponse(Response response) {
1909-
latch.countDown();
1910-
}
1911-
1912-
@Override
1913-
public final void onFailure(Exception t) {
1914-
try {
1915-
logger.info("Action Failed", t);
1916-
addError(t);
1917-
} finally {
1918-
latch.countDown();
1919-
}
1920-
}
1921-
1922-
protected void addError(Exception e) {}
1923-
1924-
}
1925-
19261902
/**
19271903
* Clears the given scroll Ids
19281904
*/

0 commit comments

Comments
 (0)