org.elasticsearch.client.Response.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.elasticsearch.client.Response.<init>方法的一些代码示例,展示了Response.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.<init>方法的具体详情如下:
包路径:org.elasticsearch.client.Response
类名称:Response
方法名:<init>

Response.<init>介绍

暂无

代码示例

代码示例来源:origin: com.strapdata.elasticsearch.client/elasticsearch-rest-client

@Override
public void completed(HttpResponse httpResponse) {
  try {
    RequestLogger.logResponse(logger, request, host, httpResponse);
    int statusCode = httpResponse.getStatusLine().getStatusCode();
    Response response = new Response(request.getRequestLine(), host, httpResponse);
    if (isSuccessfulResponse(statusCode) || ignoreErrorCodes.contains(response.getStatusLine().getStatusCode())) {
      onResponse(host);
      listener.onSuccess(response);
    } else {
      ResponseException responseException = new ResponseException(response);
      if (isRetryStatus(statusCode)) {
        //mark host dead and retry against next one
        onFailure(host);
        retryIfPossible(responseException);
      } else {
        //mark host alive and don't retry, as the error should be a request problem
        onResponse(host);
        listener.onDefinitiveFailure(responseException);
      }
    }
  } catch(Exception e) {
    listener.onDefinitiveFailure(e);
  }
}

代码示例来源:origin: org.elasticsearch.client/rest

@Override
public void completed(HttpResponse httpResponse) {
  try {
    RequestLogger.logResponse(logger, request, host, httpResponse);
    int statusCode = httpResponse.getStatusLine().getStatusCode();
    Response response = new Response(request.getRequestLine(), host, httpResponse);
    if (isSuccessfulResponse(statusCode) || ignoreErrorCodes.contains(response.getStatusLine().getStatusCode())) {
      onResponse(host);
      listener.onSuccess(response);
    } else {
      ResponseException responseException = new ResponseException(response);
      if (isRetryStatus(statusCode)) {
        //mark host dead and retry against next one
        onFailure(host);
        retryIfPossible(responseException);
      } else {
        //mark host alive and don't retry, as the error should be a request problem
        onResponse(host);
        listener.onDefinitiveFailure(responseException);
      }
    }
  } catch(Exception e) {
    listener.onDefinitiveFailure(e);
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public void completed(HttpResponse httpResponse) {
  try {
    RequestLogger.logResponse(logger, request, node.getHost(), httpResponse);
    int statusCode = httpResponse.getStatusLine().getStatusCode();
    Response response = new Response(request.getRequestLine(), node.getHost(), httpResponse);
    if (isSuccessfulResponse(statusCode) || ignoreErrorCodes.contains(response.getStatusLine().getStatusCode())) {
      onResponse(node);
      if (strictDeprecationMode && response.hasWarnings()) {
        listener.onDefinitiveFailure(new ResponseException(response));
      } else {
        listener.onSuccess(response);
      }
    } else {
      ResponseException responseException = new ResponseException(response);
      if (isRetryStatus(statusCode)) {
        //mark host dead and retry against next one
        onFailure(node);
        retryIfPossible(responseException);
      } else {
        //mark host alive and don't retry, as the error should be a request problem
        onResponse(node);
        listener.onDefinitiveFailure(responseException);
      }
    }
  } catch(Exception e) {
    listener.onDefinitiveFailure(e);
  }
}

相关文章