|
26 | 26 | import org.elasticsearch.action.ActionResponse; |
27 | 27 | import org.elasticsearch.action.ActionType; |
28 | 28 | import org.elasticsearch.action.DocWriteResponse; |
| 29 | +import org.elasticsearch.action.LatchedActionListener; |
29 | 30 | import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest; |
30 | 31 | import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse; |
31 | 32 | import org.elasticsearch.action.admin.cluster.allocation.TransportClusterAllocationExplainAction; |
@@ -1753,7 +1754,8 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma |
1753 | 1754 | logger.info("Index [{}] docs async: [{}] bulk: [{}]", builders.size(), true, false); |
1754 | 1755 | for (IndexRequestBuilder indexRequestBuilder : builders) { |
1755 | 1756 | 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)) |
1757 | 1759 | ); |
1758 | 1760 | postIndexAsyncActions(indicesArray, inFlightAsyncOperations, maybeFlush); |
1759 | 1761 | } |
@@ -1845,17 +1847,17 @@ private void postIndexAsyncActions(String[] indices, List<CountDownLatch> inFlig |
1845 | 1847 | if (rarely()) { |
1846 | 1848 | indicesAdmin().prepareRefresh(indices) |
1847 | 1849 | .setIndicesOptions(IndicesOptions.lenientExpandOpen()) |
1848 | | - .execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations))); |
| 1850 | + .execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations))); |
1849 | 1851 | } else if (maybeFlush && rarely()) { |
1850 | 1852 | indicesAdmin().prepareFlush(indices) |
1851 | 1853 | .setIndicesOptions(IndicesOptions.lenientExpandOpen()) |
1852 | | - .execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations))); |
| 1854 | + .execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations))); |
1853 | 1855 | } else if (rarely()) { |
1854 | 1856 | indicesAdmin().prepareForceMerge(indices) |
1855 | 1857 | .setIndicesOptions(IndicesOptions.lenientExpandOpen()) |
1856 | 1858 | .setMaxNumSegments(between(1, 10)) |
1857 | 1859 | .setFlush(maybeFlush && randomBoolean()) |
1858 | | - .execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations))); |
| 1860 | + .execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations))); |
1859 | 1861 | } |
1860 | 1862 | } |
1861 | 1863 | while (inFlightAsyncOperations.size() > MAX_IN_FLIGHT_ASYNC_INDEXES) { |
@@ -1939,32 +1941,6 @@ public enum Scope { |
1939 | 1941 | int numClientNodes() default InternalTestCluster.DEFAULT_NUM_CLIENT_NODES; |
1940 | 1942 | } |
1941 | 1943 |
|
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 | | - |
1968 | 1944 | /** |
1969 | 1945 | * Clears the given scroll Ids |
1970 | 1946 | */ |
|
0 commit comments