当前位置: 首页>>代码示例>>Java>>正文


Java ActionListenerResponseHandler类代码示例

本文整理汇总了Java中org.elasticsearch.action.ActionListenerResponseHandler的典型用法代码示例。如果您正苦于以下问题:Java ActionListenerResponseHandler类的具体用法?Java ActionListenerResponseHandler怎么用?Java ActionListenerResponseHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ActionListenerResponseHandler类属于org.elasticsearch.action包,在下文中一共展示了ActionListenerResponseHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendFreeContext

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendFreeContext(DiscoveryNode node, final long contextId, SearchRequest request) {
    transportService.sendRequest(node, FREE_CONTEXT_ACTION_NAME, new SearchFreeContextRequest(request, contextId), new ActionListenerResponseHandler<SearchFreeContextResponse>(new ActionListener<SearchFreeContextResponse>() {
        @Override
        public void onResponse(SearchFreeContextResponse response) {
            // no need to respond if it was freed or not
        }

        @Override
        public void onFailure(Throwable e) {

        }
    }) {
        @Override
        public SearchFreeContextResponse newInstance() {
            return new SearchFreeContextResponse();
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:SearchServiceTransportAction.java

示例2: sendFreeContext

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendFreeContext(Transport.Connection connection, final long contextId, SearchRequest request) {
    transportService.sendRequest(connection, FREE_CONTEXT_ACTION_NAME, new SearchFreeContextRequest(request, contextId),
        TransportRequestOptions.EMPTY, new ActionListenerResponseHandler<>(new ActionListener<SearchFreeContextResponse>() {
            @Override
            public void onResponse(SearchFreeContextResponse response) {
                // no need to respond if it was freed or not
            }

            @Override
            public void onFailure(Exception e) {

            }
        }, SearchFreeContextResponse::new));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:SearchTransportService.java

示例3: sendExecuteQuery

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendExecuteQuery(Transport.Connection connection, final ShardSearchTransportRequest request, SearchTask task,
                             final ActionListener<QuerySearchResultProvider> listener) {
    // we optimize this and expect a QueryFetchSearchResult if we only have a single shard in the search request
    // this used to be the QUERY_AND_FETCH which doesn't exists anymore.
    final boolean fetchDocuments = request.numberOfShards() == 1;
    Supplier<QuerySearchResultProvider> supplier = fetchDocuments ? QueryFetchSearchResult::new : QuerySearchResult::new;
    if (connection.getVersion().onOrBefore(Version.V_5_3_0_UNRELEASED) && fetchDocuments) {
        // TODO this BWC layer can be removed once this is back-ported to 5.3
        transportService.sendChildRequest(connection, QUERY_FETCH_ACTION_NAME, request, task,
            new ActionListenerResponseHandler<>(listener, supplier));
    } else {
        transportService.sendChildRequest(connection, QUERY_ACTION_NAME, request, task,
            new ActionListenerResponseHandler<>(listener, supplier));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:SearchTransportService.java

示例4: sendReplicaRequest

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
/** sends the given replica request to the supplied nodes */
protected void sendReplicaRequest(ConcreteShardRequest<ReplicaRequest> concreteShardRequest, DiscoveryNode node,
                                  ActionListener<ReplicationOperation.ReplicaResponse> listener) {
    transportService.sendRequest(node, transportReplicaAction, concreteShardRequest, transportOptions,
        // Eclipse can't handle when this is <> so we specify the type here.
        new ActionListenerResponseHandler<ReplicaResponse>(listener, ReplicaResponse::new));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:TransportReplicationAction.java

示例5: sendClearAllScrollContexts

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendClearAllScrollContexts(DiscoveryNode node, ClearScrollRequest request, final ActionListener<TransportResponse> listener) {
    transportService.sendRequest(node, CLEAR_SCROLL_CONTEXTS_ACTION_NAME, new ClearScrollContextsRequest(request), new ActionListenerResponseHandler<TransportResponse>(listener) {
        @Override
        public TransportResponse newInstance() {
            return TransportResponse.Empty.INSTANCE;
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:SearchServiceTransportAction.java

示例6: sendExecuteDfs

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendExecuteDfs(DiscoveryNode node, final ShardSearchTransportRequest request, final ActionListener<DfsSearchResult> listener) {
    transportService.sendRequest(node, DFS_ACTION_NAME, request, new ActionListenerResponseHandler<DfsSearchResult>(listener) {
        @Override
        public DfsSearchResult newInstance() {
            return new DfsSearchResult();
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:SearchServiceTransportAction.java

示例7: sendExecuteQuery

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendExecuteQuery(DiscoveryNode node, final ShardSearchTransportRequest request, final ActionListener<QuerySearchResultProvider> listener) {
    transportService.sendRequest(node, QUERY_ACTION_NAME, request, new ActionListenerResponseHandler<QuerySearchResultProvider>(listener) {
        @Override
        public QuerySearchResult newInstance() {
            return new QuerySearchResult();
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:SearchServiceTransportAction.java

示例8: sendExecuteFetch

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendExecuteFetch(DiscoveryNode node, final ShardSearchTransportRequest request, final ActionListener<QueryFetchSearchResult> listener) {
    transportService.sendRequest(node, QUERY_FETCH_ACTION_NAME, request, new ActionListenerResponseHandler<QueryFetchSearchResult>(listener) {
        @Override
        public QueryFetchSearchResult newInstance() {
            return new QueryFetchSearchResult();
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:SearchServiceTransportAction.java

示例9: sendExecuteScan

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendExecuteScan(DiscoveryNode node, final ShardSearchTransportRequest request, final ActionListener<QuerySearchResult> listener) {
    transportService.sendRequest(node, SCAN_ACTION_NAME, request, new ActionListenerResponseHandler<QuerySearchResult>(listener) {
        @Override
        public QuerySearchResult newInstance() {
            return new QuerySearchResult();
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:SearchServiceTransportAction.java

示例10: sendClearAllScrollContexts

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendClearAllScrollContexts(DiscoveryNode node, final ActionListener<TransportResponse> listener) {
    transportService.sendRequest(node, CLEAR_SCROLL_CONTEXTS_ACTION_NAME, TransportRequest.Empty.INSTANCE,
        new ActionListenerResponseHandler<>(listener, () -> TransportResponse.Empty.INSTANCE));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:SearchTransportService.java

示例11: sendExecuteDfs

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendExecuteDfs(Transport.Connection connection, final ShardSearchTransportRequest request, SearchTask task,
                           final ActionListener<DfsSearchResult> listener) {
    transportService.sendChildRequest(connection, DFS_ACTION_NAME, request, task,
        new ActionListenerResponseHandler<>(listener, DfsSearchResult::new));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:SearchTransportService.java

示例12: sendExecuteFetch

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void sendExecuteFetch(DiscoveryNode node, final InternalScrollSearchRequest request, SearchTask task,
                             final ActionListener<ScrollQueryFetchSearchResult> listener) {
    transportService.sendChildRequest(transportService.getConnection(node), QUERY_FETCH_SCROLL_ACTION_NAME, request, task,
        new ActionListenerResponseHandler<>(listener, ScrollQueryFetchSearchResult::new));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:SearchTransportService.java

示例13: sendExecuteMultiSearch

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
/**
 * Used by {@link TransportSearchAction} to send the expand queries (field collapsing).
 */
void sendExecuteMultiSearch(final MultiSearchRequest request, SearchTask task,
                                   final ActionListener<MultiSearchResponse> listener) {
    transportService.sendChildRequest(transportService.getConnection(transportService.getLocalNode()), MultiSearchAction.NAME, request,
        task, new ActionListenerResponseHandler<>(listener, MultiSearchResponse::new));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:SearchTransportService.java

示例14: doStart

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
protected void doStart(ClusterState clusterState) {
    final Predicate<ClusterState> masterChangePredicate = MasterNodeChangePredicate.build(clusterState);
    final DiscoveryNodes nodes = clusterState.nodes();
    if (nodes.isLocalNodeElectedMaster() || localExecute(request)) {
        // check for block, if blocked, retry, else, execute locally
        final ClusterBlockException blockException = checkBlock(request, clusterState);
        if (blockException != null) {
            if (!blockException.retryable()) {
                listener.onFailure(blockException);
            } else {
                logger.trace("can't execute due to a cluster block, retrying", blockException);
                retry(blockException, newState -> {
                    ClusterBlockException newException = checkBlock(request, newState);
                    return (newException == null || !newException.retryable());
                });
            }
        } else {
            ActionListener<Response> delegate = new ActionListener<Response>() {
                @Override
                public void onResponse(Response response) {
                    listener.onResponse(response);
                }

                @Override
                public void onFailure(Exception t) {
                    if (t instanceof Discovery.FailedToCommitClusterStateException
                            || (t instanceof NotMasterException)) {
                        logger.debug((org.apache.logging.log4j.util.Supplier<?>) () -> new ParameterizedMessage("master could not publish cluster state or stepped down before publishing action [{}], scheduling a retry", actionName), t);
                        retry(t, masterChangePredicate);
                    } else {
                        listener.onFailure(t);
                    }
                }
            };
            threadPool.executor(executor).execute(new ActionRunnable(delegate) {
                @Override
                protected void doRun() throws Exception {
                    masterOperation(task, request, clusterState, delegate);
                }
            });
        }
    } else {
        if (nodes.getMasterNode() == null) {
            logger.debug("no known master node, scheduling a retry");
            retry(null, masterChangePredicate);
        } else {
            transportService.sendRequest(nodes.getMasterNode(), actionName, request, new ActionListenerResponseHandler<Response>(listener, TransportMasterNodeAction.this::newResponse) {
                @Override
                public void handleException(final TransportException exp) {
                    Throwable cause = exp.unwrapCause();
                    if (cause instanceof ConnectTransportException) {
                        // we want to retry here a bit to see if a new master is elected
                        logger.debug("connection exception while trying to forward request with action name [{}] to master node [{}], scheduling a retry. Error: [{}]",
                                actionName, nodes.getMasterNode(), exp.getDetailedMessage());
                        retry(cause, masterChangePredicate);
                    } else {
                        listener.onFailure(exp);
                    }
                }
            });
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:64,代码来源:TransportMasterNodeAction.java

示例15: forwardIngestRequest

import org.elasticsearch.action.ActionListenerResponseHandler; //导入依赖的package包/类
public void forwardIngestRequest(Action<?, ?, ?> action, ActionRequest request, ActionListener<?> listener) {
    transportService.sendRequest(randomIngestNode(), action.name(), request,
        new ActionListenerResponseHandler(listener, action::newResponse));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:IngestActionForwarder.java


注:本文中的org.elasticsearch.action.ActionListenerResponseHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。