org.elasticsearch.action.support.AdapterActionFuture Java Examples

The following examples show how to use org.elasticsearch.action.support.AdapterActionFuture. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public ActionFuture<CountResponse> count(final CountRequest request) {
    AdapterActionFuture<CountResponse, SearchResponse> actionFuture = new AdapterActionFuture<CountResponse, SearchResponse>() {
        @Override
        protected CountResponse convert(SearchResponse listenerResponse) {
            return new CountResponse(listenerResponse);
        }
    };
    deprecationLogger.deprecated("the count api is deprecated and will be removed from the java api in the next major version");
    execute(SearchAction.INSTANCE, request.toSearchRequest(), actionFuture);
    return actionFuture;
}
 
Example #2
Source File: TransportClientNodesServiceInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {

    // tracking AdapterActionFuture.actionGet
    if (allArguments.length >= 2 && allArguments[1] instanceof AdapterActionFuture) {
        AdapterActionFuture actionFuture = (AdapterActionFuture) allArguments[1];
        ((EnhancedInstance) actionFuture).setSkyWalkingDynamicField(true);
    }
}
 
Example #3
Source File: SQLTransportExecutor.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * @return an array with the rowCounts
 */
private long[] executeBulk(String stmt, Object[][] bulkArgs, TimeValue timeout) {
    try {
        AdapterActionFuture<long[], long[]> actionFuture = new PlainActionFuture<>();
        execute(stmt, bulkArgs, actionFuture);
        return actionFuture.actionGet(timeout);
    } catch (ElasticsearchTimeoutException e) {
        LOGGER.error("Timeout on SQL statement: {}", e, stmt);
        throw e;
    }
}