This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 0430ef2a0a3ad70d6d2c89768d61eb5fa14c00a7 Author: Benoit Tellier <[email protected]> AuthorDate: Sat May 18 12:33:17 2019 +0700 JAMES-2765 DeleteByQueryActionListener can be replaced by ListenerToFuture --- .../es/v6/DeleteByQueryActionListener.java | 39 ---------------------- .../james/backends/es/v6/ElasticSearchIndexer.java | 2 +- .../es/v6/{search => }/ListenerToFuture.java | 2 +- .../backends/es/v6/search/ScrollIterable.java | 1 + 4 files changed, 3 insertions(+), 41 deletions(-) diff --git a/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/DeleteByQueryActionListener.java b/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/DeleteByQueryActionListener.java deleted file mode 100644 index d89a9ec..0000000 --- a/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/DeleteByQueryActionListener.java +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.backends.es.v6; - -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.index.reindex.BulkByScrollResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DeleteByQueryActionListener implements ActionListener<BulkByScrollResponse> { - private static final Logger LOGGER = LoggerFactory.getLogger(DeleteByQueryActionListener.class); - - @Override - public void onResponse(BulkByScrollResponse bulkByScrollResponse) { - - } - - @Override - public void onFailure(Exception e) { - LOGGER.warn("Error during the ES delete by query operation: ", e); - } -} diff --git a/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/ElasticSearchIndexer.java b/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/ElasticSearchIndexer.java index 9689c1a..6cf3d4a 100644 --- a/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/ElasticSearchIndexer.java +++ b/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/ElasticSearchIndexer.java @@ -117,7 +117,7 @@ public class ElasticSearchIndexer { .setQuery(queryBuilder) .setBatchSize(batchSize); - client.deleteByQueryAsync(request, RequestOptions.DEFAULT, new DeleteByQueryActionListener()); + client.deleteByQueryAsync(request, RequestOptions.DEFAULT, new ListenerToFuture<>()); } private void checkArgument(String content) { diff --git a/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/search/ListenerToFuture.java b/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/ListenerToFuture.java similarity index 97% rename from backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/search/ListenerToFuture.java rename to backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/ListenerToFuture.java index 1ae43b5..11f751e 100644 --- a/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/search/ListenerToFuture.java +++ b/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/ListenerToFuture.java @@ -17,7 +17,7 @@ * under the License. * ****************************************************************/ -package org.apache.james.backends.es.v6.search; +package org.apache.james.backends.es.v6; import java.util.concurrent.CompletableFuture; diff --git a/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/search/ScrollIterable.java b/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/search/ScrollIterable.java index a5e4a70..78ed814 100644 --- a/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/search/ScrollIterable.java +++ b/backends-common/elasticsearch-v6/src/main/java/org/apache/james/backends/es/v6/search/ScrollIterable.java @@ -23,6 +23,7 @@ import java.util.Iterator; import java.util.concurrent.CompletableFuture; import java.util.stream.Stream; +import org.apache.james.backends.es.v6.ListenerToFuture; import org.apache.james.util.streams.Iterators; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
