|
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; |
@@ -1711,7 +1712,8 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma |
1711 | 1712 | logger.info("Index [{}] docs async: [{}] bulk: [{}]", builders.size(), true, false); |
1712 | 1713 | for (IndexRequestBuilder indexRequestBuilder : builders) { |
1713 | 1714 | 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)) |
1715 | 1717 | ); |
1716 | 1718 | postIndexAsyncActions(indicesArray, inFlightAsyncOperations, maybeFlush); |
1717 | 1719 | } |
@@ -1803,17 +1805,17 @@ private void postIndexAsyncActions(String[] indices, List<CountDownLatch> inFlig |
1803 | 1805 | if (rarely()) { |
1804 | 1806 | indicesAdmin().prepareRefresh(indices) |
1805 | 1807 | .setIndicesOptions(IndicesOptions.lenientExpandOpen()) |
1806 | | - .execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations))); |
| 1808 | + .execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations))); |
1807 | 1809 | } else if (maybeFlush && rarely()) { |
1808 | 1810 | indicesAdmin().prepareFlush(indices) |
1809 | 1811 | .setIndicesOptions(IndicesOptions.lenientExpandOpen()) |
1810 | | - .execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations))); |
| 1812 | + .execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations))); |
1811 | 1813 | } else if (rarely()) { |
1812 | 1814 | indicesAdmin().prepareForceMerge(indices) |
1813 | 1815 | .setIndicesOptions(IndicesOptions.lenientExpandOpen()) |
1814 | 1816 | .setMaxNumSegments(between(1, 10)) |
1815 | 1817 | .setFlush(maybeFlush && randomBoolean()) |
1816 | | - .execute(new LatchedActionListener<>(newLatch(inFlightAsyncOperations))); |
| 1818 | + .execute(new LatchedActionListener<>(ActionListener.noop(), newLatch(inFlightAsyncOperations))); |
1817 | 1819 | } |
1818 | 1820 | } |
1819 | 1821 | while (inFlightAsyncOperations.size() > MAX_IN_FLIGHT_ASYNC_INDEXES) { |
@@ -1897,32 +1899,6 @@ public enum Scope { |
1897 | 1899 | int numClientNodes() default InternalTestCluster.DEFAULT_NUM_CLIENT_NODES; |
1898 | 1900 | } |
1899 | 1901 |
|
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 | | - |
1926 | 1902 | /** |
1927 | 1903 | * Clears the given scroll Ids |
1928 | 1904 | */ |
|
0 commit comments