refactor client api, remove execXXX, and simple remain with the actual operation name as the method name, one that returns a future, and one that accepts a listener

This commit is contained in:
kimchy 2010-03-05 01:39:04 +02:00
parent e49a8454a6
commit 7bf0f1ffca
37 changed files with 176 additions and 733 deletions

View File

@ -20,16 +20,13 @@
package org.elasticsearch.action;
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.util.Nullable;
/**
* @author kimchy (Shay Banon)
*/
public interface Action<Request extends ActionRequest, Response extends ActionResponse> {
ActionFuture<Response> submit(Request request) throws ElasticSearchException;
ActionFuture<Response> submit(Request request, @Nullable ActionListener<Response> listener);
ActionFuture<Response> execute(Request request) throws ElasticSearchException;
void execute(Request request, ActionListener<Response> listener);
}

View File

@ -21,14 +21,13 @@ package org.elasticsearch.action.support;
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.action.*;
import org.elasticsearch.util.Nullable;
import org.elasticsearch.util.component.AbstractComponent;
import org.elasticsearch.util.settings.Settings;
import static org.elasticsearch.action.support.PlainActionFuture.*;
/**
* @author kimchy (Shay Banon)
* @author kimchy (shay.banon)
*/
public abstract class BaseAction<Request extends ActionRequest, Response extends ActionResponse> extends AbstractComponent implements Action<Request, Response> {
@ -36,17 +35,11 @@ public abstract class BaseAction<Request extends ActionRequest, Response extends
super(settings);
}
@Override public ActionFuture<Response> submit(Request request) throws ElasticSearchException {
return submit(request, null);
}
@Override public ActionFuture<Response> submit(Request request, @Nullable ActionListener<Response> listener) {
PlainActionFuture<Response> future = newFuture(listener);
if (listener == null) {
// since we don't have a listener, and we release a possible lock with the future
// there is no need to execute it under a listener thread
request.listenerThreaded(false);
}
@Override public ActionFuture<Response> execute(Request request) throws ElasticSearchException {
PlainActionFuture<Response> future = newFuture();
// since we don't have a listener, and we release a possible lock with the future
// there is no need to execute it under a listener thread
request.listenerThreaded(false);
execute(request, future);
return future;
}
@ -60,5 +53,5 @@ public abstract class BaseAction<Request extends ActionRequest, Response extends
doExecute(request, listener);
}
protected abstract void doExecute(Request request, ActionListener<Response> responseActionListener);
protected abstract void doExecute(Request request, ActionListener<Response> listener);
}

View File

@ -24,7 +24,6 @@ import org.elasticsearch.ElasticSearchInterruptedException;
import org.elasticsearch.action.ActionFuture;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.transport.TransportException;
import org.elasticsearch.util.Nullable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
@ -32,20 +31,14 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* @author kimchy (Shay Banon)
* @author kimchy (shay.banon)
*/
public class PlainActionFuture<T> implements ActionFuture<T>, ActionListener<T> {
public static <T> PlainActionFuture<T> newFuture() {
return newFuture(null);
return new PlainActionFuture<T>();
}
public static <T> PlainActionFuture<T> newFuture(@Nullable ActionListener<T> listener) {
return new PlainActionFuture<T>(listener);
}
private final ActionListener<T> listener;
private final CountDownLatch latch;
private volatile boolean done;
@ -53,8 +46,7 @@ public class PlainActionFuture<T> implements ActionFuture<T>, ActionListener<T>
private volatile T result;
private volatile Throwable exp;
public PlainActionFuture(ActionListener<T> listener) {
this.listener = listener;
public PlainActionFuture() {
latch = new CountDownLatch(1);
}
@ -142,9 +134,6 @@ public class PlainActionFuture<T> implements ActionFuture<T>, ActionListener<T>
if (canceled)
return;
if (listener != null) {
listener.onResponse(result);
}
latch.countDown();
}
@ -155,9 +144,6 @@ public class PlainActionFuture<T> implements ActionFuture<T>, ActionListener<T>
if (canceled)
return;
if (listener != null) {
listener.onFailure(exp);
}
latch.countDown();
}
}

View File

@ -41,10 +41,9 @@ import org.elasticsearch.action.terms.TermsResponse;
/**
* A client provides a one stop interface for performing actions/operations against the cluster.
*
* <p>All operations performed are asynchronous by nature. There are three flavors for each operation,
* the simplest returns an {@link ActionFuture}, another that also accepts an {@link ActionListener},
* and the last (prefixed with <tt>exec</tt>) which just accepts an {@link ActionListener} without returning
* an {@link ActionFuture}.
* <p>All operations performed are asynchronous by nature. Each action/operation has two flavors, the first
* simply returns an {@link org.elasticsearch.action.ActionFuture}, while the second accepts an
* {@link org.elasticsearch.action.ActionListener}.
*
* <p>A client can either be retrieved from a {@link org.elasticsearch.server.Server} started, or connected remotely
* to one or more nodes using {@link org.elasticsearch.client.transport.TransportClient}.
@ -83,21 +82,9 @@ public interface Client {
*
* @param request The index request
* @param listener A listener to be notified with a result
* @return The result future
* @see Requests#indexRequest(String)
*/
ActionFuture<IndexResponse> index(IndexRequest request, ActionListener<IndexResponse> listener);
/**
* Index a JSON source associated with a given index and type.
*
* <p>The id is optional, if it is not provided, one will be generated automatically.
*
* @param request The index request
* @param listener A listener to be notified with a result
* @see Requests#indexRequest(String)
*/
void execIndex(IndexRequest request, ActionListener<IndexResponse> listener);
void index(IndexRequest request, ActionListener<IndexResponse> listener);
/**
* Deletes a document from the index based on the index, type and id.
@ -113,19 +100,9 @@ public interface Client {
*
* @param request The delete request
* @param listener A listener to be notified with a result
* @return The result future
* @see Requests#deleteRequest(String)
*/
ActionFuture<DeleteResponse> delete(DeleteRequest request, ActionListener<DeleteResponse> listener);
/**
* Deletes a document from the index based on the index, type and id.
*
* @param request The delete request
* @param listener A listener to be notified with a result
* @see Requests#deleteRequest(String)
*/
void execDelete(DeleteRequest request, ActionListener<DeleteResponse> listener);
void delete(DeleteRequest request, ActionListener<DeleteResponse> listener);
/**
* Deletes all documents from one or more indices based on a query.
@ -141,19 +118,9 @@ public interface Client {
*
* @param request The delete by query request
* @param listener A listener to be notified with a result
* @return The result future
* @see Requests#deleteByQueryRequest(String...)
*/
ActionFuture<DeleteByQueryResponse> deleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener);
/**
* Deletes all documents from one or more indices based on a query.
*
* @param request The delete by query request
* @param listener A listener to be notified with a result
* @see Requests#deleteByQueryRequest(String...)
*/
void execDeleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener);
void deleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener);
/**
* Gets the JSON source that was indexed from an index with a type and id.
@ -169,19 +136,9 @@ public interface Client {
*
* @param request The get request
* @param listener A listener to be notified with a result
* @return The result future
* @see Requests#getRequest(String)
*/
ActionFuture<GetResponse> get(GetRequest request, ActionListener<GetResponse> listener);
/**
* Gets the JSON source that was indexed from an index with a type and id.
*
* @param request The get request
* @param listener A listener to be notified with a result
* @see Requests#getRequest(String)
*/
void execGet(GetRequest request, ActionListener<GetResponse> listener);
void get(GetRequest request, ActionListener<GetResponse> listener);
/**
* A count of all the documents matching a specific query.
@ -197,19 +154,9 @@ public interface Client {
*
* @param request The count request
* @param listener A listener to be notified of the result
* @return The result future
* @see Requests#countRequest(String...)
*/
ActionFuture<CountResponse> count(CountRequest request, ActionListener<CountResponse> listener);
/**
* A count of all the documents matching a specific query.
*
* @param request The count request
* @param listener A listener to be notified of the result
* @see Requests#countRequest(String...)
*/
void execCount(CountRequest request, ActionListener<CountResponse> listener);
void count(CountRequest request, ActionListener<CountResponse> listener);
/**
* Search across one or more indices and one or more types with a query.
@ -225,19 +172,9 @@ public interface Client {
*
* @param request The search request
* @param listener A listener to be notified of the result
* @return The result future
* @see Requests#searchRequest(String...)
*/
ActionFuture<SearchResponse> search(SearchRequest request, ActionListener<SearchResponse> listener);
/**
* Search across one or more indices and one or more types with a query.
*
* @param request The search request
* @param listener A listener to be notified of the result
* @see Requests#searchRequest(String...)
*/
void execSearch(SearchRequest request, ActionListener<SearchResponse> listener);
void search(SearchRequest request, ActionListener<SearchResponse> listener);
/**
* A search scroll request to continue searching a previous scrollable search request.
@ -253,19 +190,9 @@ public interface Client {
*
* @param request The search scroll request
* @param listener A listener to be notified of the result
* @return The result future
* @see Requests#searchScrollRequest(String)
*/
ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener);
/**
* A search scroll request to continue searching a previous scrollable search request.
*
* @param request The search scroll request
* @param listener A listener to be notified of the result
* @see Requests#searchScrollRequest(String)
*/
void execSearchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener);
void searchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener);
/**
* A terms request to get terms in one or more indices of specific fields and their
@ -283,20 +210,9 @@ public interface Client {
*
* @param request The term request
* @param listener A listener to be notified of the result
* @return The result future
* @see Requests#termsRequest(String...)
*/
ActionFuture<TermsResponse> terms(TermsRequest request, ActionListener<TermsResponse> listener);
/**
* A terms request to get terms in one or more indices of specific fields and their
* document frequencies (in how many document each term exists).
*
* @param request The term request
* @param listener A listener to be notified of the result
* @see Requests#termsRequest(String...)
*/
void execTerms(TermsRequest request, ActionListener<TermsResponse> listener);
void terms(TermsRequest request, ActionListener<TermsResponse> listener);
/**
* A more like this action to search for documents that are "like" a specific document.
@ -311,15 +227,6 @@ public interface Client {
*
* @param request The more like this request
* @param listener A listener to be notified of the result
* @return The response future
*/
ActionFuture<SearchResponse> moreLikeThis(MoreLikeThisRequest request, ActionListener<SearchResponse> listener);
/**
* A more like this action to search for documents that are "like" a specific document.
*
* @param request The more like this request
* @param listener A listener to be notified of the result
*/
void execMoreLikeThis(MoreLikeThisRequest request, ActionListener<SearchResponse> listener);
void moreLikeThis(MoreLikeThisRequest request, ActionListener<SearchResponse> listener);
}

View File

@ -56,19 +56,9 @@ public interface ClusterAdminClient {
*
* @param request The cluster state request
* @param listener A listener to be notified with a result
* @return The result future
* @see Requests#clusterHealth(String...)
*/
ActionFuture<ClusterHealthResponse> health(ClusterHealthRequest request, ActionListener<ClusterHealthResponse> listener);
/**
* The health of the cluster.
*
* @param request The cluster state request
* @param listener A listener to be notified with a result
* @see Requests#clusterHealth(String...)
*/
void execHealth(ClusterHealthRequest request, ActionListener<ClusterHealthResponse> listener);
void health(ClusterHealthRequest request, ActionListener<ClusterHealthResponse> listener);
/**
* The state of the cluster.
@ -84,19 +74,9 @@ public interface ClusterAdminClient {
*
* @param request The cluster state request.
* @param listener A listener to be notified with a result
* @return The result future
* @see Requests#clusterState()
*/
ActionFuture<ClusterStateResponse> state(ClusterStateRequest request, ActionListener<ClusterStateResponse> listener);
/**
* The state of the cluster.
*
* @param request The cluster state request.
* @param listener A listener to be notified with a result
* @see Requests#clusterState()
*/
void execState(ClusterStateRequest request, ActionListener<ClusterStateResponse> listener);
void state(ClusterStateRequest request, ActionListener<ClusterStateResponse> listener);
/**
* Nodes info of the cluster.
@ -112,35 +92,19 @@ public interface ClusterAdminClient {
*
* @param request The nodes info request
* @param listener A listener to be notified with a result
* @return The result future
* @see org.elasticsearch.client.Requests#nodesInfo(String...)
*/
ActionFuture<NodesInfoResponse> nodesInfo(NodesInfoRequest request, ActionListener<NodesInfoResponse> listener);
/**
* Nodes info of the cluster.
*
* @param request The nodes info request
* @param listener A listener to be notified with a result
* @see org.elasticsearch.client.Requests#nodesInfo(String...)
*/
void execNodesInfo(NodesInfoRequest request, ActionListener<NodesInfoResponse> listener);
void nodesInfo(NodesInfoRequest request, ActionListener<NodesInfoResponse> listener);
ActionFuture<SinglePingResponse> ping(SinglePingRequest request);
ActionFuture<SinglePingResponse> ping(SinglePingRequest request, ActionListener<SinglePingResponse> listener);
void execPing(SinglePingRequest request, ActionListener<SinglePingResponse> listener);
void ping(SinglePingRequest request, ActionListener<SinglePingResponse> listener);
ActionFuture<BroadcastPingResponse> ping(BroadcastPingRequest request);
ActionFuture<BroadcastPingResponse> ping(BroadcastPingRequest request, ActionListener<BroadcastPingResponse> listener);
void execPing(BroadcastPingRequest request, ActionListener<BroadcastPingResponse> listener);
void ping(BroadcastPingRequest request, ActionListener<BroadcastPingResponse> listener);
ActionFuture<ReplicationPingResponse> ping(ReplicationPingRequest request);
ActionFuture<ReplicationPingResponse> ping(ReplicationPingRequest request, ActionListener<ReplicationPingResponse> listener);
void execPing(ReplicationPingRequest request, ActionListener<ReplicationPingResponse> listener);
void ping(ReplicationPingRequest request, ActionListener<ReplicationPingResponse> listener);
}

View File

@ -60,19 +60,9 @@ public interface IndicesAdminClient {
*
* @param request The indices status request
* @param listener A listener to be notified with a result
* @return The result future
* @see Requests#indicesStatus(String...)
*/
ActionFuture<IndicesStatusResponse> status(IndicesStatusRequest request, ActionListener<IndicesStatusResponse> listener);
/**
* The status of one or more indices.
*
* @param request The indices status request
* @param listener A listener to be notified with a result
* @see Requests#indicesStatus(String...)
*/
void execStatus(IndicesStatusRequest request, ActionListener<IndicesStatusResponse> listener);
void status(IndicesStatusRequest request, ActionListener<IndicesStatusResponse> listener);
/**
* Creates an index using an explicit request allowing to specify the settings of the index.
@ -88,19 +78,9 @@ public interface IndicesAdminClient {
*
* @param request The create index request
* @param listener A listener to be notified with a result
* @return The result future
* @see org.elasticsearch.client.Requests#createIndexRequest(String)
*/
ActionFuture<CreateIndexResponse> create(CreateIndexRequest request, ActionListener<CreateIndexResponse> listener);
/**
* Creates an index using an explicit request allowing to specify the settings of the index.
*
* @param request The create index request
* @param listener A listener to be notified with a result
* @see org.elasticsearch.client.Requests#createIndexRequest(String)
*/
void execCreate(CreateIndexRequest request, ActionListener<CreateIndexResponse> listener);
void create(CreateIndexRequest request, ActionListener<CreateIndexResponse> listener);
/**
* Deletes an index based on the index name.
@ -116,19 +96,9 @@ public interface IndicesAdminClient {
*
* @param request The delete index request
* @param listener A listener to be notified with a result
* @return The result future
* @see org.elasticsearch.client.Requests#deleteIndexRequest(String)
*/
ActionFuture<DeleteIndexResponse> delete(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener);
/**
* Deletes an index based on the index name.
*
* @param request The delete index request
* @param listener A listener to be notified with a result
* @see org.elasticsearch.client.Requests#deleteIndexRequest(String)
*/
void execDelete(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener);
void delete(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener);
/**
* Explicitly refresh one or more indices (making the content indexed since the last refresh searchable).
@ -144,19 +114,9 @@ public interface IndicesAdminClient {
*
* @param request The refresh request
* @param listener A listener to be notified with a result
* @return The result future
* @see org.elasticsearch.client.Requests#refreshRequest(String...)
*/
ActionFuture<RefreshResponse> refresh(RefreshRequest request, ActionListener<RefreshResponse> listener);
/**
* Explicitly refresh one or more indices (making the content indexed since the last refresh searchable).
*
* @param request The refresh request
* @param listener A listener to be notified with a result
* @see org.elasticsearch.client.Requests#refreshRequest(String...)
*/
void execRefresh(RefreshRequest request, ActionListener<RefreshResponse> listener);
void refresh(RefreshRequest request, ActionListener<RefreshResponse> listener);
/**
* Explicitly flush one or more indices (releasing memory from the node).
@ -172,19 +132,9 @@ public interface IndicesAdminClient {
*
* @param request The flush request
* @param listener A listener to be notified with a result
* @return A result future
* @see org.elasticsearch.client.Requests#flushRequest(String...)
*/
ActionFuture<FlushResponse> flush(FlushRequest request, ActionListener<FlushResponse> listener);
/**
* Explicitly flush one or more indices (releasing memory from the node).
*
* @param request The flush request
* @param listener A listener to be notified with a result
* @see org.elasticsearch.client.Requests#flushRequest(String...)
*/
void execFlush(FlushRequest request, ActionListener<FlushResponse> listener);
void flush(FlushRequest request, ActionListener<FlushResponse> listener);
/**
* Explicitly optimize one or more indices into a the number of segments.
@ -200,19 +150,9 @@ public interface IndicesAdminClient {
*
* @param request The optimize request
* @param listener A listener to be notified with a result
* @return A result future
* @see org.elasticsearch.client.Requests#optimizeRequest(String...)
*/
ActionFuture<OptimizeResponse> optimize(OptimizeRequest request, ActionListener<OptimizeResponse> listener);
/**
* Explicitly optimize one or more indices into a the number of segments.
*
* @param request The optimize request
* @param listener A listener to be notified with a result
* @see org.elasticsearch.client.Requests#optimizeRequest(String...)
*/
void execOptimize(OptimizeRequest request, ActionListener<OptimizeResponse> listener);
void optimize(OptimizeRequest request, ActionListener<OptimizeResponse> listener);
/**
* Add mapping definition for a type into one or more indices.
@ -228,19 +168,9 @@ public interface IndicesAdminClient {
*
* @param request The create mapping request
* @param listener A listener to be notified with a result
* @return A result future
* @see org.elasticsearch.client.Requests#putMappingRequest(String...)
*/
ActionFuture<PutMappingResponse> putMapping(PutMappingRequest request, ActionListener<PutMappingResponse> listener);
/**
* Add mapping definition for a type into one or more indices.
*
* @param request The create mapping request
* @param listener A listener to be notified with a result
* @see org.elasticsearch.client.Requests#putMappingRequest(String...)
*/
void execPutMapping(PutMappingRequest request, ActionListener<PutMappingResponse> listener);
void putMapping(PutMappingRequest request, ActionListener<PutMappingResponse> listener);
/**
* Explicitly perform gateway snapshot for one or more indices.
@ -256,17 +186,7 @@ public interface IndicesAdminClient {
*
* @param request The gateway snapshot request
* @param listener A listener to be notified with a result
* @return The result future
* @see org.elasticsearch.client.Requests#gatewaySnapshotRequest(String...)
*/
ActionFuture<GatewaySnapshotResponse> gatewaySnapshot(GatewaySnapshotRequest request, ActionListener<GatewaySnapshotResponse> listener);
/**
* Explicitly perform gateway snapshot for one or more indices.
*
* @param request The gateway snapshot request
* @param listener A listener to be notified with a result
* @see org.elasticsearch.client.Requests#gatewaySnapshotRequest(String...)
*/
void execGatewaySnapshot(GatewaySnapshotRequest request, ActionListener<GatewaySnapshotResponse> listener);
void gatewaySnapshot(GatewaySnapshotRequest request, ActionListener<GatewaySnapshotResponse> listener);
}

View File

@ -100,110 +100,74 @@ public class ServerClient extends AbstractComponent implements Client {
}
@Override public ActionFuture<IndexResponse> index(IndexRequest request) {
return indexAction.submit(request);
return indexAction.execute(request);
}
@Override public ActionFuture<IndexResponse> index(IndexRequest request, ActionListener<IndexResponse> listener) {
return indexAction.submit(request, listener);
}
@Override public void execIndex(IndexRequest request, ActionListener<IndexResponse> listener) {
@Override public void index(IndexRequest request, ActionListener<IndexResponse> listener) {
indexAction.execute(request, listener);
}
@Override public ActionFuture<DeleteResponse> delete(DeleteRequest request) {
return deleteAction.submit(request);
return deleteAction.execute(request);
}
@Override public ActionFuture<DeleteResponse> delete(DeleteRequest request, ActionListener<DeleteResponse> listener) {
return deleteAction.submit(request, listener);
}
@Override public void execDelete(DeleteRequest request, ActionListener<DeleteResponse> listener) {
@Override public void delete(DeleteRequest request, ActionListener<DeleteResponse> listener) {
deleteAction.execute(request, listener);
}
@Override public ActionFuture<DeleteByQueryResponse> deleteByQuery(DeleteByQueryRequest request) {
return deleteByQueryAction.submit(request);
return deleteByQueryAction.execute(request);
}
@Override public ActionFuture<DeleteByQueryResponse> deleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener) {
return deleteByQueryAction.submit(request, listener);
}
@Override public void execDeleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener) {
@Override public void deleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener) {
deleteByQueryAction.execute(request, listener);
}
@Override public ActionFuture<GetResponse> get(GetRequest request) {
return getAction.submit(request);
return getAction.execute(request);
}
@Override public ActionFuture<GetResponse> get(GetRequest request, ActionListener<GetResponse> listener) {
return getAction.submit(request, listener);
}
@Override public void execGet(GetRequest request, ActionListener<GetResponse> listener) {
@Override public void get(GetRequest request, ActionListener<GetResponse> listener) {
getAction.execute(request, listener);
}
@Override public ActionFuture<CountResponse> count(CountRequest request) {
return countAction.submit(request);
return countAction.execute(request);
}
@Override public ActionFuture<CountResponse> count(CountRequest request, ActionListener<CountResponse> listener) {
return countAction.submit(request, listener);
}
@Override public void execCount(CountRequest request, ActionListener<CountResponse> listener) {
countAction.execute(request, listener);
@Override public void count(CountRequest request, ActionListener<CountResponse> listener) {
countAction.execute(request);
}
@Override public ActionFuture<SearchResponse> search(SearchRequest request) {
return searchAction.submit(request);
return searchAction.execute(request);
}
@Override public ActionFuture<SearchResponse> search(SearchRequest request, ActionListener<SearchResponse> listener) {
return searchAction.submit(request, listener);
}
@Override public void execSearch(SearchRequest request, ActionListener<SearchResponse> listener) {
@Override public void search(SearchRequest request, ActionListener<SearchResponse> listener) {
searchAction.execute(request, listener);
}
@Override public ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request) {
return searchScrollAction.submit(request);
return searchScrollAction.execute(request);
}
@Override public ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener) {
return searchScrollAction.submit(request, listener);
}
@Override public void execSearchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener) {
@Override public void searchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener) {
searchScrollAction.execute(request, listener);
}
@Override public ActionFuture<TermsResponse> terms(TermsRequest request) {
return termsAction.submit(request);
return termsAction.execute(request);
}
@Override public ActionFuture<TermsResponse> terms(TermsRequest request, ActionListener<TermsResponse> listener) {
return termsAction.submit(request, listener);
}
@Override public void execTerms(TermsRequest request, ActionListener<TermsResponse> listener) {
@Override public void terms(TermsRequest request, ActionListener<TermsResponse> listener) {
termsAction.execute(request, listener);
}
@Override public ActionFuture<SearchResponse> moreLikeThis(MoreLikeThisRequest request) {
return moreLikeThisAction.submit(request);
return moreLikeThisAction.execute(request);
}
@Override public ActionFuture<SearchResponse> moreLikeThis(MoreLikeThisRequest request, ActionListener<SearchResponse> listener) {
return moreLikeThisAction.submit(request, listener);
}
@Override public void execMoreLikeThis(MoreLikeThisRequest request, ActionListener<SearchResponse> listener) {
@Override public void moreLikeThis(MoreLikeThisRequest request, ActionListener<SearchResponse> listener) {
moreLikeThisAction.execute(request, listener);
}
}

View File

@ -75,74 +75,50 @@ public class ServerClusterAdminClient extends AbstractComponent implements Clust
}
@Override public ActionFuture<ClusterHealthResponse> health(ClusterHealthRequest request) {
return clusterHealthAction.submit(request);
return clusterHealthAction.execute(request);
}
@Override public ActionFuture<ClusterHealthResponse> health(ClusterHealthRequest request, ActionListener<ClusterHealthResponse> listener) {
return clusterHealthAction.submit(request, listener);
}
@Override public void execHealth(ClusterHealthRequest request, ActionListener<ClusterHealthResponse> listener) {
@Override public void health(ClusterHealthRequest request, ActionListener<ClusterHealthResponse> listener) {
clusterHealthAction.execute(request, listener);
}
@Override public ActionFuture<ClusterStateResponse> state(ClusterStateRequest request) {
return clusterStateAction.submit(request);
return clusterStateAction.execute(request);
}
@Override public ActionFuture<ClusterStateResponse> state(ClusterStateRequest request, ActionListener<ClusterStateResponse> listener) {
return clusterStateAction.submit(request, listener);
}
@Override public void execState(ClusterStateRequest request, ActionListener<ClusterStateResponse> listener) {
@Override public void state(ClusterStateRequest request, ActionListener<ClusterStateResponse> listener) {
clusterStateAction.execute(request, listener);
}
@Override public ActionFuture<SinglePingResponse> ping(SinglePingRequest request) {
return singlePingAction.submit(request);
return singlePingAction.execute(request);
}
@Override public ActionFuture<SinglePingResponse> ping(SinglePingRequest request, ActionListener<SinglePingResponse> listener) {
return singlePingAction.submit(request, listener);
}
@Override public void execPing(SinglePingRequest request, ActionListener<SinglePingResponse> listener) {
@Override public void ping(SinglePingRequest request, ActionListener<SinglePingResponse> listener) {
singlePingAction.execute(request, listener);
}
@Override public ActionFuture<BroadcastPingResponse> ping(BroadcastPingRequest request) {
return broadcastPingAction.submit(request);
return broadcastPingAction.execute(request);
}
@Override public ActionFuture<BroadcastPingResponse> ping(BroadcastPingRequest request, ActionListener<BroadcastPingResponse> listener) {
return broadcastPingAction.submit(request, listener);
}
@Override public void execPing(BroadcastPingRequest request, ActionListener<BroadcastPingResponse> listener) {
@Override public void ping(BroadcastPingRequest request, ActionListener<BroadcastPingResponse> listener) {
broadcastPingAction.execute(request, listener);
}
@Override public ActionFuture<ReplicationPingResponse> ping(ReplicationPingRequest request) {
return replicationPingAction.submit(request);
return replicationPingAction.execute(request);
}
@Override public ActionFuture<ReplicationPingResponse> ping(ReplicationPingRequest request, ActionListener<ReplicationPingResponse> listener) {
return replicationPingAction.submit(request, listener);
}
@Override public void execPing(ReplicationPingRequest request, ActionListener<ReplicationPingResponse> listener) {
@Override public void ping(ReplicationPingRequest request, ActionListener<ReplicationPingResponse> listener) {
replicationPingAction.execute(request, listener);
}
@Override public ActionFuture<NodesInfoResponse> nodesInfo(NodesInfoRequest request) {
return nodesInfo.submit(request);
return nodesInfo.execute(request);
}
@Override public ActionFuture<NodesInfoResponse> nodesInfo(NodesInfoRequest request, ActionListener<NodesInfoResponse> listener) {
return nodesInfo.submit(request, listener);
}
@Override public void execNodesInfo(NodesInfoRequest request, ActionListener<NodesInfoResponse> listener) {
@Override public void nodesInfo(NodesInfoRequest request, ActionListener<NodesInfoResponse> listener) {
nodesInfo.execute(request, listener);
}

View File

@ -87,98 +87,66 @@ public class ServerIndicesAdminClient extends AbstractComponent implements Indic
}
@Override public ActionFuture<IndicesStatusResponse> status(IndicesStatusRequest request) {
return indicesStatusAction.submit(request);
return indicesStatusAction.execute(request);
}
@Override public ActionFuture<IndicesStatusResponse> status(IndicesStatusRequest request, ActionListener<IndicesStatusResponse> listener) {
return indicesStatusAction.submit(request, listener);
}
@Override public void execStatus(IndicesStatusRequest request, ActionListener<IndicesStatusResponse> listener) {
@Override public void status(IndicesStatusRequest request, ActionListener<IndicesStatusResponse> listener) {
indicesStatusAction.execute(request, listener);
}
@Override public ActionFuture<CreateIndexResponse> create(CreateIndexRequest request) {
return createIndexAction.submit(request);
return createIndexAction.execute(request);
}
@Override public ActionFuture<CreateIndexResponse> create(CreateIndexRequest request, ActionListener<CreateIndexResponse> listener) {
return createIndexAction.submit(request, listener);
}
@Override public void execCreate(CreateIndexRequest request, ActionListener<CreateIndexResponse> listener) {
@Override public void create(CreateIndexRequest request, ActionListener<CreateIndexResponse> listener) {
createIndexAction.execute(request, listener);
}
@Override public ActionFuture<DeleteIndexResponse> delete(DeleteIndexRequest request) {
return deleteIndexAction.submit(request);
return deleteIndexAction.execute(request);
}
@Override public ActionFuture<DeleteIndexResponse> delete(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener) {
return deleteIndexAction.submit(request, listener);
}
@Override public void execDelete(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener) {
@Override public void delete(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener) {
deleteIndexAction.execute(request, listener);
}
@Override public ActionFuture<RefreshResponse> refresh(RefreshRequest request) {
return refreshAction.submit(request);
return refreshAction.execute(request);
}
@Override public ActionFuture<RefreshResponse> refresh(RefreshRequest request, ActionListener<RefreshResponse> listener) {
return refreshAction.submit(request, listener);
}
@Override public void execRefresh(RefreshRequest request, ActionListener<RefreshResponse> listener) {
@Override public void refresh(RefreshRequest request, ActionListener<RefreshResponse> listener) {
refreshAction.execute(request, listener);
}
@Override public ActionFuture<FlushResponse> flush(FlushRequest request) {
return flushAction.submit(request);
return flushAction.execute(request);
}
@Override public ActionFuture<FlushResponse> flush(FlushRequest request, ActionListener<FlushResponse> listener) {
return flushAction.submit(request, listener);
}
@Override public void execFlush(FlushRequest request, ActionListener<FlushResponse> listener) {
@Override public void flush(FlushRequest request, ActionListener<FlushResponse> listener) {
flushAction.execute(request, listener);
}
@Override public ActionFuture<OptimizeResponse> optimize(OptimizeRequest request) {
return optimizeAction.submit(request);
return optimizeAction.execute(request);
}
@Override public ActionFuture<OptimizeResponse> optimize(OptimizeRequest request, ActionListener<OptimizeResponse> listener) {
return optimizeAction.submit(request, listener);
}
@Override public void execOptimize(OptimizeRequest request, ActionListener<OptimizeResponse> listener) {
@Override public void optimize(OptimizeRequest request, ActionListener<OptimizeResponse> listener) {
optimizeAction.execute(request, listener);
}
@Override public ActionFuture<PutMappingResponse> putMapping(PutMappingRequest request) {
return putMappingAction.submit(request);
return putMappingAction.execute(request);
}
@Override public ActionFuture<PutMappingResponse> putMapping(PutMappingRequest request, ActionListener<PutMappingResponse> listener) {
return putMapping(request, listener);
}
@Override public void execPutMapping(PutMappingRequest request, ActionListener<PutMappingResponse> listener) {
@Override public void putMapping(PutMappingRequest request, ActionListener<PutMappingResponse> listener) {
putMappingAction.execute(request, listener);
}
@Override public ActionFuture<GatewaySnapshotResponse> gatewaySnapshot(GatewaySnapshotRequest request) {
return gatewaySnapshotAction.submit(request);
return gatewaySnapshotAction.execute(request);
}
@Override public ActionFuture<GatewaySnapshotResponse> gatewaySnapshot(GatewaySnapshotRequest request, ActionListener<GatewaySnapshotResponse> listener) {
return gatewaySnapshotAction.submit(request, listener);
}
@Override public void execGatewaySnapshot(GatewaySnapshotRequest request, ActionListener<GatewaySnapshotResponse> listener) {
@Override public void gatewaySnapshot(GatewaySnapshotRequest request, ActionListener<GatewaySnapshotResponse> listener) {
gatewaySnapshotAction.execute(request, listener);
}
}

View File

@ -214,95 +214,63 @@ public class TransportClient implements Client {
return internalClient.index(request);
}
@Override public ActionFuture<IndexResponse> index(IndexRequest request, ActionListener<IndexResponse> listener) {
return internalClient.index(request, listener);
}
@Override public void execIndex(IndexRequest request, ActionListener<IndexResponse> listener) {
internalClient.execIndex(request, listener);
@Override public void index(IndexRequest request, ActionListener<IndexResponse> listener) {
internalClient.index(request, listener);
}
@Override public ActionFuture<DeleteResponse> delete(DeleteRequest request) {
return internalClient.delete(request);
}
@Override public ActionFuture<DeleteResponse> delete(DeleteRequest request, ActionListener<DeleteResponse> listener) {
return internalClient.delete(request, listener);
}
@Override public void execDelete(DeleteRequest request, ActionListener<DeleteResponse> listener) {
internalClient.execDelete(request, listener);
@Override public void delete(DeleteRequest request, ActionListener<DeleteResponse> listener) {
internalClient.delete(request, listener);
}
@Override public ActionFuture<DeleteByQueryResponse> deleteByQuery(DeleteByQueryRequest request) {
return internalClient.deleteByQuery(request);
}
@Override public ActionFuture<DeleteByQueryResponse> deleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener) {
return internalClient.deleteByQuery(request, listener);
}
@Override public void execDeleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener) {
internalClient.execDeleteByQuery(request, listener);
@Override public void deleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener) {
internalClient.deleteByQuery(request, listener);
}
@Override public ActionFuture<GetResponse> get(GetRequest request) {
return internalClient.get(request);
}
@Override public ActionFuture<GetResponse> get(GetRequest request, ActionListener<GetResponse> listener) {
return internalClient.get(request, listener);
}
@Override public void execGet(GetRequest request, ActionListener<GetResponse> listener) {
internalClient.execGet(request, listener);
@Override public void get(GetRequest request, ActionListener<GetResponse> listener) {
internalClient.get(request, listener);
}
@Override public ActionFuture<CountResponse> count(CountRequest request) {
return internalClient.count(request);
}
@Override public ActionFuture<CountResponse> count(CountRequest request, ActionListener<CountResponse> listener) {
return internalClient.count(request, listener);
}
@Override public void execCount(CountRequest request, ActionListener<CountResponse> listener) {
internalClient.execCount(request, listener);
@Override public void count(CountRequest request, ActionListener<CountResponse> listener) {
internalClient.count(request, listener);
}
@Override public ActionFuture<SearchResponse> search(SearchRequest request) {
return internalClient.search(request);
}
@Override public ActionFuture<SearchResponse> search(SearchRequest request, ActionListener<SearchResponse> listener) {
return internalClient.search(request, listener);
}
@Override public void execSearch(SearchRequest request, ActionListener<SearchResponse> listener) {
internalClient.execSearch(request, listener);
@Override public void search(SearchRequest request, ActionListener<SearchResponse> listener) {
internalClient.search(request, listener);
}
@Override public ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request) {
return internalClient.searchScroll(request);
}
@Override public ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener) {
return internalClient.searchScroll(request, listener);
}
@Override public void execSearchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener) {
internalClient.execSearchScroll(request, listener);
@Override public void searchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener) {
internalClient.searchScroll(request, listener);
}
@Override public ActionFuture<TermsResponse> terms(TermsRequest request) {
return internalClient.terms(request);
}
@Override public ActionFuture<TermsResponse> terms(TermsRequest request, ActionListener<TermsResponse> listener) {
return internalClient.terms(request, listener);
}
@Override public void execTerms(TermsRequest request, ActionListener<TermsResponse> listener) {
@Override public void terms(TermsRequest request, ActionListener<TermsResponse> listener) {
internalClient.terms(request, listener);
}
@ -310,11 +278,7 @@ public class TransportClient implements Client {
return internalClient.moreLikeThis(request);
}
@Override public ActionFuture<SearchResponse> moreLikeThis(MoreLikeThisRequest request, ActionListener<SearchResponse> listener) {
return internalClient.moreLikeThis(request, listener);
}
@Override public void execMoreLikeThis(MoreLikeThisRequest request, ActionListener<SearchResponse> listener) {
internalClient.execMoreLikeThis(request, listener);
@Override public void moreLikeThis(MoreLikeThisRequest request, ActionListener<SearchResponse> listener) {
internalClient.moreLikeThis(request, listener);
}
}

View File

@ -25,16 +25,13 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.cluster.node.Node;
import org.elasticsearch.util.Nullable;
/**
* @author kimchy (Shay Banon)
*/
public interface ClientTransportAction<Request extends ActionRequest, Response extends ActionResponse> {
ActionFuture<Response> submit(Node node, Request request) throws ElasticSearchException;
ActionFuture<Response> submit(Node node, Request request, @Nullable ActionListener<Response> listener);
ActionFuture<Response> execute(Node node, Request request) throws ElasticSearchException;
void execute(Node node, Request request, ActionListener<Response> listener);
}

View File

@ -32,7 +32,6 @@ import org.elasticsearch.cluster.node.Node;
import org.elasticsearch.transport.BaseTransportResponseHandler;
import org.elasticsearch.transport.RemoteTransportException;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.util.Nullable;
import org.elasticsearch.util.component.AbstractComponent;
import org.elasticsearch.util.settings.Settings;
@ -41,7 +40,7 @@ import java.lang.reflect.Constructor;
import static org.elasticsearch.action.support.PlainActionFuture.*;
/**
* @author kimchy (Shay Banon)
* @author kimchy (shay.banon)
*/
public abstract class BaseClientTransportAction<Request extends ActionRequest, Response extends ActionResponse> extends AbstractComponent implements ClientTransportAction<Request, Response> {
@ -60,17 +59,9 @@ public abstract class BaseClientTransportAction<Request extends ActionRequest, R
responseConstructor.setAccessible(true);
}
@Override public ActionFuture<Response> submit(Node node, Request request) throws ElasticSearchException {
return submit(node, request, null);
}
@Override public ActionFuture<Response> submit(Node node, Request request, @Nullable ActionListener<Response> listener) {
PlainActionFuture<Response> future = newFuture(listener);
if (listener == null) {
// since we don't have a listener, and we release a possible lock with the future
// there is no need to execute it under a listener thread
request.listenerThreaded(false);
}
@Override public ActionFuture<Response> execute(Node node, Request request) throws ElasticSearchException {
PlainActionFuture<Response> future = newFuture();
request.listenerThreaded(false);
execute(node, request, future);
return future;
}

View File

@ -113,20 +113,12 @@ public class InternalTransportClient extends AbstractComponent implements Client
@Override public ActionFuture<IndexResponse> index(final IndexRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<IndexResponse>>() {
@Override public ActionFuture<IndexResponse> doWithNode(Node node) throws ElasticSearchException {
return indexAction.submit(node, request);
return indexAction.execute(node, request);
}
});
}
@Override public ActionFuture<IndexResponse> index(final IndexRequest request, final ActionListener<IndexResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<IndexResponse>>() {
@Override public ActionFuture<IndexResponse> doWithNode(Node node) throws ElasticSearchException {
return indexAction.submit(node, request, listener);
}
});
}
@Override public void execIndex(final IndexRequest request, final ActionListener<IndexResponse> listener) {
@Override public void index(final IndexRequest request, final ActionListener<IndexResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
indexAction.execute(node, request, listener);
@ -138,20 +130,12 @@ public class InternalTransportClient extends AbstractComponent implements Client
@Override public ActionFuture<DeleteResponse> delete(final DeleteRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteResponse>>() {
@Override public ActionFuture<DeleteResponse> doWithNode(Node node) throws ElasticSearchException {
return deleteAction.submit(node, request);
return deleteAction.execute(node, request);
}
});
}
@Override public ActionFuture<DeleteResponse> delete(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteResponse>>() {
@Override public ActionFuture<DeleteResponse> doWithNode(Node node) throws ElasticSearchException {
return deleteAction.submit(node, request, listener);
}
});
}
@Override public void execDelete(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
@Override public void delete(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
deleteAction.execute(node, request, listener);
@ -163,20 +147,12 @@ public class InternalTransportClient extends AbstractComponent implements Client
@Override public ActionFuture<DeleteByQueryResponse> deleteByQuery(final DeleteByQueryRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteByQueryResponse>>() {
@Override public ActionFuture<DeleteByQueryResponse> doWithNode(Node node) throws ElasticSearchException {
return deleteByQueryAction.submit(node, request);
return deleteByQueryAction.execute(node, request);
}
});
}
@Override public ActionFuture<DeleteByQueryResponse> deleteByQuery(final DeleteByQueryRequest request, final ActionListener<DeleteByQueryResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteByQueryResponse>>() {
@Override public ActionFuture<DeleteByQueryResponse> doWithNode(Node node) throws ElasticSearchException {
return deleteByQueryAction.submit(node, request, listener);
}
});
}
@Override public void execDeleteByQuery(final DeleteByQueryRequest request, final ActionListener<DeleteByQueryResponse> listener) {
@Override public void deleteByQuery(final DeleteByQueryRequest request, final ActionListener<DeleteByQueryResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
deleteByQueryAction.execute(node, request, listener);
@ -188,20 +164,12 @@ public class InternalTransportClient extends AbstractComponent implements Client
@Override public ActionFuture<GetResponse> get(final GetRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<GetResponse>>() {
@Override public ActionFuture<GetResponse> doWithNode(Node node) throws ElasticSearchException {
return getAction.submit(node, request);
return getAction.execute(node, request);
}
});
}
@Override public ActionFuture<GetResponse> get(final GetRequest request, final ActionListener<GetResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<GetResponse>>() {
@Override public ActionFuture<GetResponse> doWithNode(Node node) throws ElasticSearchException {
return getAction.submit(node, request, listener);
}
});
}
@Override public void execGet(final GetRequest request, final ActionListener<GetResponse> listener) {
@Override public void get(final GetRequest request, final ActionListener<GetResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
@Override public Object doWithNode(Node node) throws ElasticSearchException {
getAction.execute(node, request, listener);
@ -213,20 +181,12 @@ public class InternalTransportClient extends AbstractComponent implements Client
@Override public ActionFuture<CountResponse> count(final CountRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<CountResponse>>() {
@Override public ActionFuture<CountResponse> doWithNode(Node node) throws ElasticSearchException {
return countAction.submit(node, request);
return countAction.execute(node, request);
}
});
}
@Override public ActionFuture<CountResponse> count(final CountRequest request, final ActionListener<CountResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<CountResponse>>() {
@Override public ActionFuture<CountResponse> doWithNode(Node node) throws ElasticSearchException {
return countAction.submit(node, request, listener);
}
});
}
@Override public void execCount(final CountRequest request, final ActionListener<CountResponse> listener) {
@Override public void count(final CountRequest request, final ActionListener<CountResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
countAction.execute(node, request, listener);
@ -238,20 +198,12 @@ public class InternalTransportClient extends AbstractComponent implements Client
@Override public ActionFuture<SearchResponse> search(final SearchRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() {
@Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException {
return searchAction.submit(node, request);
return searchAction.execute(node, request);
}
});
}
@Override public ActionFuture<SearchResponse> search(final SearchRequest request, final ActionListener<SearchResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() {
@Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException {
return searchAction.submit(node, request, listener);
}
});
}
@Override public void execSearch(final SearchRequest request, final ActionListener<SearchResponse> listener) {
@Override public void search(final SearchRequest request, final ActionListener<SearchResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
@Override public Object doWithNode(Node node) throws ElasticSearchException {
searchAction.execute(node, request, listener);
@ -263,20 +215,12 @@ public class InternalTransportClient extends AbstractComponent implements Client
@Override public ActionFuture<SearchResponse> searchScroll(final SearchScrollRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() {
@Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException {
return searchScrollAction.submit(node, request);
return searchScrollAction.execute(node, request);
}
});
}
@Override public ActionFuture<SearchResponse> searchScroll(final SearchScrollRequest request, final ActionListener<SearchResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() {
@Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException {
return searchScrollAction.submit(node, request, listener);
}
});
}
@Override public void execSearchScroll(final SearchScrollRequest request, final ActionListener<SearchResponse> listener) {
@Override public void searchScroll(final SearchScrollRequest request, final ActionListener<SearchResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
@Override public Object doWithNode(Node node) throws ElasticSearchException {
searchScrollAction.execute(node, request, listener);
@ -288,20 +232,12 @@ public class InternalTransportClient extends AbstractComponent implements Client
@Override public ActionFuture<TermsResponse> terms(final TermsRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<TermsResponse>>() {
@Override public ActionFuture<TermsResponse> doWithNode(Node node) throws ElasticSearchException {
return termsAction.submit(node, request);
return termsAction.execute(node, request);
}
});
}
@Override public ActionFuture<TermsResponse> terms(final TermsRequest request, final ActionListener<TermsResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<TermsResponse>>() {
@Override public ActionFuture<TermsResponse> doWithNode(Node node) throws ElasticSearchException {
return termsAction.submit(node, request, listener);
}
});
}
@Override public void execTerms(final TermsRequest request, final ActionListener<TermsResponse> listener) {
@Override public void terms(final TermsRequest request, final ActionListener<TermsResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<Void>>() {
@Override public ActionFuture<Void> doWithNode(Node node) throws ElasticSearchException {
termsAction.execute(node, request, listener);
@ -313,23 +249,15 @@ public class InternalTransportClient extends AbstractComponent implements Client
@Override public ActionFuture<SearchResponse> moreLikeThis(final MoreLikeThisRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() {
@Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException {
return moreLikeThisAction.submit(node, request);
return moreLikeThisAction.execute(node, request);
}
});
}
@Override public ActionFuture<SearchResponse> moreLikeThis(final MoreLikeThisRequest request, final ActionListener<SearchResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() {
@Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException {
return moreLikeThisAction.submit(node, request, listener);
}
});
}
@Override public void execMoreLikeThis(final MoreLikeThisRequest request, final ActionListener<SearchResponse> listener) {
@Override public void moreLikeThis(final MoreLikeThisRequest request, final ActionListener<SearchResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
moreLikeThisAction.submit(node, request);
moreLikeThisAction.execute(node, request, listener);
return null;
}
});

View File

@ -83,20 +83,12 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple
@Override public ActionFuture<ClusterHealthResponse> health(final ClusterHealthRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ClusterHealthResponse>>() {
@Override public ActionFuture<ClusterHealthResponse> doWithNode(Node node) throws ElasticSearchException {
return clusterHealthAction.submit(node, request);
return clusterHealthAction.execute(node, request);
}
});
}
@Override public ActionFuture<ClusterHealthResponse> health(final ClusterHealthRequest request, final ActionListener<ClusterHealthResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ClusterHealthResponse>>() {
@Override public ActionFuture<ClusterHealthResponse> doWithNode(Node node) throws ElasticSearchException {
return clusterHealthAction.submit(node, request, listener);
}
});
}
@Override public void execHealth(final ClusterHealthRequest request, final ActionListener<ClusterHealthResponse> listener) {
@Override public void health(final ClusterHealthRequest request, final ActionListener<ClusterHealthResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
clusterHealthAction.execute(node, request, listener);
@ -108,20 +100,12 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple
@Override public ActionFuture<ClusterStateResponse> state(final ClusterStateRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ClusterStateResponse>>() {
@Override public ActionFuture<ClusterStateResponse> doWithNode(Node node) throws ElasticSearchException {
return clusterStateAction.submit(node, request);
return clusterStateAction.execute(node, request);
}
});
}
@Override public ActionFuture<ClusterStateResponse> state(final ClusterStateRequest request, final ActionListener<ClusterStateResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ClusterStateResponse>>() {
@Override public ActionFuture<ClusterStateResponse> doWithNode(Node node) throws ElasticSearchException {
return clusterStateAction.submit(node, request, listener);
}
});
}
@Override public void execState(final ClusterStateRequest request, final ActionListener<ClusterStateResponse> listener) {
@Override public void state(final ClusterStateRequest request, final ActionListener<ClusterStateResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
clusterStateAction.execute(node, request, listener);
@ -133,20 +117,12 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple
@Override public ActionFuture<SinglePingResponse> ping(final SinglePingRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SinglePingResponse>>() {
@Override public ActionFuture<SinglePingResponse> doWithNode(Node node) throws ElasticSearchException {
return singlePingAction.submit(node, request);
return singlePingAction.execute(node, request);
}
});
}
@Override public ActionFuture<SinglePingResponse> ping(final SinglePingRequest request, final ActionListener<SinglePingResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SinglePingResponse>>() {
@Override public ActionFuture<SinglePingResponse> doWithNode(Node node) throws ElasticSearchException {
return singlePingAction.submit(node, request, listener);
}
});
}
@Override public void execPing(final SinglePingRequest request, final ActionListener<SinglePingResponse> listener) {
@Override public void ping(final SinglePingRequest request, final ActionListener<SinglePingResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
singlePingAction.execute(node, request, listener);
@ -158,20 +134,12 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple
@Override public ActionFuture<BroadcastPingResponse> ping(final BroadcastPingRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<BroadcastPingResponse>>() {
@Override public ActionFuture<BroadcastPingResponse> doWithNode(Node node) throws ElasticSearchException {
return broadcastPingAction.submit(node, request);
return broadcastPingAction.execute(node, request);
}
});
}
@Override public ActionFuture<BroadcastPingResponse> ping(final BroadcastPingRequest request, final ActionListener<BroadcastPingResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<BroadcastPingResponse>>() {
@Override public ActionFuture<BroadcastPingResponse> doWithNode(Node node) throws ElasticSearchException {
return broadcastPingAction.submit(node, request, listener);
}
});
}
@Override public void execPing(final BroadcastPingRequest request, final ActionListener<BroadcastPingResponse> listener) {
@Override public void ping(final BroadcastPingRequest request, final ActionListener<BroadcastPingResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
broadcastPingAction.execute(node, request, listener);
@ -183,20 +151,12 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple
@Override public ActionFuture<ReplicationPingResponse> ping(final ReplicationPingRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ReplicationPingResponse>>() {
@Override public ActionFuture<ReplicationPingResponse> doWithNode(Node node) throws ElasticSearchException {
return replicationPingAction.submit(node, request);
return replicationPingAction.execute(node, request);
}
});
}
@Override public ActionFuture<ReplicationPingResponse> ping(final ReplicationPingRequest request, final ActionListener<ReplicationPingResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ReplicationPingResponse>>() {
@Override public ActionFuture<ReplicationPingResponse> doWithNode(Node node) throws ElasticSearchException {
return replicationPingAction.submit(node, request, listener);
}
});
}
@Override public void execPing(final ReplicationPingRequest request, final ActionListener<ReplicationPingResponse> listener) {
@Override public void ping(final ReplicationPingRequest request, final ActionListener<ReplicationPingResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
replicationPingAction.execute(node, request, listener);
@ -208,20 +168,12 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple
@Override public ActionFuture<NodesInfoResponse> nodesInfo(final NodesInfoRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<NodesInfoResponse>>() {
@Override public ActionFuture<NodesInfoResponse> doWithNode(Node node) throws ElasticSearchException {
return nodesInfoAction.submit(node, request);
return nodesInfoAction.execute(node, request);
}
});
}
@Override public ActionFuture<NodesInfoResponse> nodesInfo(final NodesInfoRequest request, final ActionListener<NodesInfoResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<NodesInfoResponse>>() {
@Override public ActionFuture<NodesInfoResponse> doWithNode(Node node) throws ElasticSearchException {
return nodesInfoAction.submit(node, request, listener);
}
});
}
@Override public void execNodesInfo(final NodesInfoRequest request, final ActionListener<NodesInfoResponse> listener) {
@Override public void nodesInfo(final NodesInfoRequest request, final ActionListener<NodesInfoResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
nodesInfoAction.execute(node, request, listener);

View File

@ -96,20 +96,12 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple
@Override public ActionFuture<IndicesStatusResponse> status(final IndicesStatusRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<IndicesStatusResponse>>() {
@Override public ActionFuture<IndicesStatusResponse> doWithNode(Node node) throws ElasticSearchException {
return indicesStatusAction.submit(node, request);
return indicesStatusAction.execute(node, request);
}
});
}
@Override public ActionFuture<IndicesStatusResponse> status(final IndicesStatusRequest request, final ActionListener<IndicesStatusResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<IndicesStatusResponse>>() {
@Override public ActionFuture<IndicesStatusResponse> doWithNode(Node node) throws ElasticSearchException {
return indicesStatusAction.submit(node, request, listener);
}
});
}
@Override public void execStatus(final IndicesStatusRequest request, final ActionListener<IndicesStatusResponse> listener) {
@Override public void status(final IndicesStatusRequest request, final ActionListener<IndicesStatusResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
indicesStatusAction.execute(node, request, listener);
@ -121,20 +113,12 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple
@Override public ActionFuture<CreateIndexResponse> create(final CreateIndexRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<CreateIndexResponse>>() {
@Override public ActionFuture<CreateIndexResponse> doWithNode(Node node) throws ElasticSearchException {
return createIndexAction.submit(node, request);
return createIndexAction.execute(node, request);
}
});
}
@Override public ActionFuture<CreateIndexResponse> create(final CreateIndexRequest request, final ActionListener<CreateIndexResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<CreateIndexResponse>>() {
@Override public ActionFuture<CreateIndexResponse> doWithNode(Node node) throws ElasticSearchException {
return createIndexAction.submit(node, request, listener);
}
});
}
@Override public void execCreate(final CreateIndexRequest request, final ActionListener<CreateIndexResponse> listener) {
@Override public void create(final CreateIndexRequest request, final ActionListener<CreateIndexResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
@Override public Object doWithNode(Node node) throws ElasticSearchException {
createIndexAction.execute(node, request, listener);
@ -146,20 +130,12 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple
@Override public ActionFuture<DeleteIndexResponse> delete(final DeleteIndexRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteIndexResponse>>() {
@Override public ActionFuture<DeleteIndexResponse> doWithNode(Node node) throws ElasticSearchException {
return deleteIndexAction.submit(node, request);
return deleteIndexAction.execute(node, request);
}
});
}
@Override public ActionFuture<DeleteIndexResponse> delete(final DeleteIndexRequest request, final ActionListener<DeleteIndexResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteIndexResponse>>() {
@Override public ActionFuture<DeleteIndexResponse> doWithNode(Node node) throws ElasticSearchException {
return deleteIndexAction.submit(node, request, listener);
}
});
}
@Override public void execDelete(final DeleteIndexRequest request, final ActionListener<DeleteIndexResponse> listener) {
@Override public void delete(final DeleteIndexRequest request, final ActionListener<DeleteIndexResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
@Override public Object doWithNode(Node node) throws ElasticSearchException {
deleteIndexAction.execute(node, request, listener);
@ -171,20 +147,12 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple
@Override public ActionFuture<RefreshResponse> refresh(final RefreshRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<RefreshResponse>>() {
@Override public ActionFuture<RefreshResponse> doWithNode(Node node) throws ElasticSearchException {
return refreshAction.submit(node, request);
return refreshAction.execute(node, request);
}
});
}
@Override public ActionFuture<RefreshResponse> refresh(final RefreshRequest request, final ActionListener<RefreshResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<RefreshResponse>>() {
@Override public ActionFuture<RefreshResponse> doWithNode(Node node) throws ElasticSearchException {
return refreshAction.submit(node, request, listener);
}
});
}
@Override public void execRefresh(final RefreshRequest request, final ActionListener<RefreshResponse> listener) {
@Override public void refresh(final RefreshRequest request, final ActionListener<RefreshResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
refreshAction.execute(node, request, listener);
@ -196,20 +164,12 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple
@Override public ActionFuture<FlushResponse> flush(final FlushRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<FlushResponse>>() {
@Override public ActionFuture<FlushResponse> doWithNode(Node node) throws ElasticSearchException {
return flushAction.submit(node, request);
return flushAction.execute(node, request);
}
});
}
@Override public ActionFuture<FlushResponse> flush(final FlushRequest request, final ActionListener<FlushResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<FlushResponse>>() {
@Override public ActionFuture<FlushResponse> doWithNode(Node node) throws ElasticSearchException {
return flushAction.submit(node, request, listener);
}
});
}
@Override public void execFlush(final FlushRequest request, final ActionListener<FlushResponse> listener) {
@Override public void flush(final FlushRequest request, final ActionListener<FlushResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
@Override public Object doWithNode(Node node) throws ElasticSearchException {
flushAction.execute(node, request, listener);
@ -221,20 +181,12 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple
@Override public ActionFuture<OptimizeResponse> optimize(final OptimizeRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<OptimizeResponse>>() {
@Override public ActionFuture<OptimizeResponse> doWithNode(Node node) throws ElasticSearchException {
return optimizeAction.submit(node, request);
return optimizeAction.execute(node, request);
}
});
}
@Override public ActionFuture<OptimizeResponse> optimize(final OptimizeRequest request, final ActionListener<OptimizeResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<OptimizeResponse>>() {
@Override public ActionFuture<OptimizeResponse> doWithNode(Node node) throws ElasticSearchException {
return optimizeAction.submit(node, request, listener);
}
});
}
@Override public void execOptimize(final OptimizeRequest request, final ActionListener<OptimizeResponse> listener) {
@Override public void optimize(final OptimizeRequest request, final ActionListener<OptimizeResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<Void>>() {
@Override public ActionFuture<Void> doWithNode(Node node) throws ElasticSearchException {
optimizeAction.execute(node, request, listener);
@ -246,20 +198,12 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple
@Override public ActionFuture<PutMappingResponse> putMapping(final PutMappingRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<PutMappingResponse>>() {
@Override public ActionFuture<PutMappingResponse> doWithNode(Node node) throws ElasticSearchException {
return putMappingAction.submit(node, request);
return putMappingAction.execute(node, request);
}
});
}
@Override public ActionFuture<PutMappingResponse> putMapping(final PutMappingRequest request, final ActionListener<PutMappingResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<PutMappingResponse>>() {
@Override public ActionFuture<PutMappingResponse> doWithNode(Node node) throws ElasticSearchException {
return putMappingAction.submit(node, request, listener);
}
});
}
@Override public void execPutMapping(final PutMappingRequest request, final ActionListener<PutMappingResponse> listener) {
@Override public void putMapping(final PutMappingRequest request, final ActionListener<PutMappingResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
@Override public Void doWithNode(Node node) throws ElasticSearchException {
putMappingAction.execute(node, request, listener);
@ -271,20 +215,12 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple
@Override public ActionFuture<GatewaySnapshotResponse> gatewaySnapshot(final GatewaySnapshotRequest request) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<GatewaySnapshotResponse>>() {
@Override public ActionFuture<GatewaySnapshotResponse> doWithNode(Node node) throws ElasticSearchException {
return gatewaySnapshotAction.submit(node, request);
return gatewaySnapshotAction.execute(node, request);
}
});
}
@Override public ActionFuture<GatewaySnapshotResponse> gatewaySnapshot(final GatewaySnapshotRequest request, final ActionListener<GatewaySnapshotResponse> listener) {
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<GatewaySnapshotResponse>>() {
@Override public ActionFuture<GatewaySnapshotResponse> doWithNode(Node node) throws ElasticSearchException {
return gatewaySnapshotAction.submit(node, request, listener);
}
});
}
@Override public void execGatewaySnapshot(final GatewaySnapshotRequest request, final ActionListener<GatewaySnapshotResponse> listener) {
@Override public void gatewaySnapshot(final GatewaySnapshotRequest request, final ActionListener<GatewaySnapshotResponse> listener) {
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
@Override public Object doWithNode(Node node) throws ElasticSearchException {
gatewaySnapshotAction.execute(node, request, listener);

View File

@ -76,7 +76,7 @@ public class RestClusterHealthAction extends BaseRestHandler {
return;
}
final int fLevel = level;
client.admin().cluster().execHealth(clusterHealthRequest, new ActionListener<ClusterHealthResponse>() {
client.admin().cluster().health(clusterHealthRequest, new ActionListener<ClusterHealthResponse>() {
@Override public void onResponse(ClusterHealthResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -51,7 +51,7 @@ public class RestNodesInfoAction extends BaseRestHandler {
final boolean includeSettings = request.paramAsBoolean("settings", false);
NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(nodesIds);
nodesInfoRequest.listenerThreaded(false);
client.admin().cluster().execNodesInfo(nodesInfoRequest, new ActionListener<NodesInfoResponse>() {
client.admin().cluster().nodesInfo(nodesInfoRequest, new ActionListener<NodesInfoResponse>() {
@Override public void onResponse(NodesInfoResponse result) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -56,7 +56,7 @@ public class RestBroadcastPingAction extends BaseRestHandler {
operationThreading = BroadcastOperationThreading.SINGLE_THREAD;
}
broadcastPingRequest.operationThreading(operationThreading);
client.admin().cluster().execPing(broadcastPingRequest, new ActionListener<BroadcastPingResponse>() {
client.admin().cluster().ping(broadcastPingRequest, new ActionListener<BroadcastPingResponse>() {
@Override public void onResponse(BroadcastPingResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -51,7 +51,7 @@ public class RestReplicationPingAction extends BaseRestHandler {
ReplicationPingRequest replicationPingRequest = new ReplicationPingRequest(RestActions.splitIndices(request.param("index")));
replicationPingRequest.timeout(request.paramAsTime("timeout", ShardReplicationPingRequest.DEFAULT_TIMEOUT));
replicationPingRequest.listenerThreaded(false);
client.admin().cluster().execPing(replicationPingRequest, new ActionListener<ReplicationPingResponse>() {
client.admin().cluster().ping(replicationPingRequest, new ActionListener<ReplicationPingResponse>() {
@Override public void onResponse(ReplicationPingResponse result) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -50,7 +50,7 @@ public class RestSinglePingAction extends BaseRestHandler {
singlePingRequest.listenerThreaded(false);
// if we have a local operation, execute it on a thread since we don't spawn
singlePingRequest.threadedOperation(true);
client.admin().cluster().execPing(singlePingRequest, new ActionListener<SinglePingResponse>() {
client.admin().cluster().ping(singlePingRequest, new ActionListener<SinglePingResponse>() {
@Override public void onResponse(SinglePingResponse result) {
try {
JsonBuilder generator = RestJsonBuilder.restJsonBuilder(request);

View File

@ -50,7 +50,7 @@ public class RestClusterStateAction extends BaseRestHandler {
}
@Override public void handleRequest(final RestRequest request, final RestChannel channel) {
client.admin().cluster().execState(new ClusterStateRequest(), new ActionListener<ClusterStateResponse>() {
client.admin().cluster().state(new ClusterStateRequest(), new ActionListener<ClusterStateResponse>() {
@Override public void onResponse(ClusterStateResponse response) {
try {
ClusterState state = response.state();

View File

@ -67,7 +67,7 @@ public class RestCreateIndexAction extends BaseRestHandler {
}
CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index"), indexSettings);
createIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
client.admin().indices().execCreate(createIndexRequest, new ActionListener<CreateIndexResponse>() {
client.admin().indices().create(createIndexRequest, new ActionListener<CreateIndexResponse>() {
@Override public void onResponse(CreateIndexResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -49,7 +49,7 @@ public class RestDeleteIndexAction extends BaseRestHandler {
@Override public void handleRequest(final RestRequest request, final RestChannel channel) {
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(request.param("index"));
deleteIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
client.admin().indices().execDelete(deleteIndexRequest, new ActionListener<DeleteIndexResponse>() {
client.admin().indices().delete(deleteIndexRequest, new ActionListener<DeleteIndexResponse>() {
@Override public void onResponse(DeleteIndexResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -59,7 +59,7 @@ public class RestFlushAction extends BaseRestHandler {
}
flushRequest.operationThreading(operationThreading);
flushRequest.refresh(request.paramAsBoolean("refresh", flushRequest.refresh()));
client.admin().indices().execFlush(flushRequest, new ActionListener<FlushResponse>() {
client.admin().indices().flush(flushRequest, new ActionListener<FlushResponse>() {
@Override public void onResponse(FlushResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -52,7 +52,7 @@ public class RestGatewaySnapshotAction extends BaseRestHandler {
GatewaySnapshotRequest gatewaySnapshotRequest = new GatewaySnapshotRequest(RestActions.splitIndices(request.param("index")));
gatewaySnapshotRequest.timeout(request.paramAsTime("timeout", DEFAULT_TIMEOUT));
gatewaySnapshotRequest.listenerThreaded(false);
client.admin().indices().execGatewaySnapshot(gatewaySnapshotRequest, new ActionListener<GatewaySnapshotResponse>() {
client.admin().indices().gatewaySnapshot(gatewaySnapshotRequest, new ActionListener<GatewaySnapshotResponse>() {
@Override public void onResponse(GatewaySnapshotResponse result) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -58,7 +58,7 @@ public class RestPutMappingAction extends BaseRestHandler {
putMappingRequest.mappingSource(request.contentAsString());
putMappingRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
putMappingRequest.ignoreConflicts(request.paramAsBoolean("ignoreConflicts", putMappingRequest.ignoreConflicts()));
client.admin().indices().execPutMapping(putMappingRequest, new ActionListener<PutMappingResponse>() {
client.admin().indices().putMapping(putMappingRequest, new ActionListener<PutMappingResponse>() {
@Override public void onResponse(PutMappingResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -74,7 +74,7 @@ public class RestOptimizeAction extends BaseRestHandler {
}
return;
}
client.admin().indices().execOptimize(optimizeRequest, new ActionListener<OptimizeResponse>() {
client.admin().indices().optimize(optimizeRequest, new ActionListener<OptimizeResponse>() {
@Override public void onResponse(OptimizeResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -58,7 +58,7 @@ public class RestRefreshAction extends BaseRestHandler {
operationThreading = BroadcastOperationThreading.THREAD_PER_SHARD;
}
refreshRequest.operationThreading(operationThreading);
client.admin().indices().execRefresh(refreshRequest, new ActionListener<RefreshResponse>() {
client.admin().indices().refresh(refreshRequest, new ActionListener<RefreshResponse>() {
@Override public void onResponse(RefreshResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -57,7 +57,7 @@ public class RestIndicesStatusAction extends BaseRestHandler {
operationThreading = BroadcastOperationThreading.SINGLE_THREAD;
}
indicesStatusRequest.operationThreading(operationThreading);
client.admin().indices().execStatus(indicesStatusRequest, new ActionListener<IndicesStatusResponse>() {
client.admin().indices().status(indicesStatusRequest, new ActionListener<IndicesStatusResponse>() {
@Override public void onResponse(IndicesStatusResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -82,7 +82,7 @@ public class RestCountAction extends BaseRestHandler {
return;
}
client.execCount(countRequest, new ActionListener<CountResponse>() {
client.count(countRequest, new ActionListener<CountResponse>() {
@Override public void onResponse(CountResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -51,7 +51,7 @@ public class RestDeleteAction extends BaseRestHandler {
deleteRequest.listenerThreaded(false);
// we don't spawn, then fork if local
deleteRequest.operationThreaded(true);
client.execDelete(deleteRequest, new ActionListener<DeleteResponse>() {
client.delete(deleteRequest, new ActionListener<DeleteResponse>() {
@Override public void onResponse(DeleteResponse result) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -70,7 +70,7 @@ public class RestDeleteByQueryAction extends BaseRestHandler {
}
return;
}
client.execDeleteByQuery(deleteByQueryRequest, new ActionListener<DeleteByQueryResponse>() {
client.deleteByQuery(deleteByQueryRequest, new ActionListener<DeleteByQueryResponse>() {
@Override public void onResponse(DeleteByQueryResponse result) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -50,7 +50,7 @@ public class RestGetAction extends BaseRestHandler {
getRequest.listenerThreaded(false);
// if we have a local operation, execute it on a thread since we don't spawn
getRequest.threadedOperation(true);
client.execGet(getRequest, new ActionListener<GetResponse>() {
client.get(getRequest, new ActionListener<GetResponse>() {
@Override public void onResponse(GetResponse result) {
try {
if (!result.exists()) {

View File

@ -68,7 +68,7 @@ public class RestIndexAction extends BaseRestHandler {
indexRequest.listenerThreaded(false);
// we don't spawn, then fork if local
indexRequest.operationThreaded(true);
client.execIndex(indexRequest, new ActionListener<IndexResponse>() {
client.index(indexRequest, new ActionListener<IndexResponse>() {
@Override public void onResponse(IndexResponse result) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -90,7 +90,7 @@ public class RestSearchAction extends BaseRestHandler {
}
return;
}
client.execSearch(searchRequest, new ActionListener<SearchResponse>() {
client.search(searchRequest, new ActionListener<SearchResponse>() {
@Override public void onResponse(SearchResponse response) {
try {
JsonBuilder builder = restJsonBuilder(request);

View File

@ -109,7 +109,7 @@ public class RestTermsAction extends BaseRestHandler {
}
final boolean termsAsArray = request.paramAsBoolean("termsAsArray", true);
client.execTerms(termsRequest, new ActionListener<TermsResponse>() {
client.terms(termsRequest, new ActionListener<TermsResponse>() {
@Override public void onResponse(TermsResponse response) {
try {
JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request);

View File

@ -127,7 +127,7 @@ public class DocumentActionsTests extends AbstractServersTests {
logger.info("Index [type1/1]");
client1.index(indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet();
logger.info("Index [type1/2]");
client1.index(indexRequest("test").type("type1").id("2").source(source("2", "test"))).actionGet();
client1.index(indexRequest("test").type("type1").id("2").source(source("2", "test2"))).actionGet();
logger.info("Flushing");
FlushResponse flushResult = client1.admin().indices().flush(flushRequest("test")).actionGet();
@ -141,7 +141,7 @@ public class DocumentActionsTests extends AbstractServersTests {
getResult = client1.get(getRequest("test").type("type1").id("1")).actionGet();
assertThat("cycle #" + i, getResult.sourceAsString(), equalTo(source("1", "test")));
getResult = client1.get(getRequest("test").type("type1").id("2")).actionGet();
assertThat("cycle #" + i, getResult.sourceAsString(), equalTo(source("2", "test")));
assertThat("cycle #" + i, getResult.sourceAsString(), equalTo(source("2", "test2")));
}
logger.info("Count");