Remove uses of unnecessary callback interface
This commit removes uses of a callback interface that is unnecessary in
core as we can use java.util.function.Consumer instead.
Relates elastic/x-pack-elasticsearch#1654
Original commit: elastic/x-pack-elasticsearch@21f470e97400e2a9ccfb2909bb473fcc55511869
@@ -27,8 +27,6 @@ import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
-import org.elasticsearch.common.util.Callback;
-import org.elasticsearch.common.util.iterable.Iterables;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
@@ -97,6 +95,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -476,10 +475,10 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
}
}
- protected SearchResponse searchWatchRecords(Callback<SearchRequestBuilder> requestBuilderCallback) {
+ protected SearchResponse searchWatchRecords(Consumer<SearchRequestBuilder> requestBuilderCallback) {
SearchRequestBuilder builder =
client().prepareSearch(HistoryStore.INDEX_PREFIX_WITH_TEMPLATE + "*").setTypes(HistoryStore.DOC_TYPE);
- requestBuilderCallback.handle(builder);
+ requestBuilderCallback.accept(builder);
return builder.get();
}
