private void getWorkflowExecutionHistory()

in src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java [2292:2352]


  private void getWorkflowExecutionHistory(
      GetWorkflowExecutionHistoryRequest getRequest,
      AsyncMethodCallback resultHandler,
      Long timeoutInMillis) {

    ThriftRequest<WorkflowService.GetWorkflowExecutionHistory_args> request =
        buildGetWorkflowExecutionHistoryThriftRequest(getRequest, timeoutInMillis);

    CompletableFuture<ThriftResponse<GetWorkflowExecutionHistory_result>> response =
        doRemoteCallAsync(request);
    response
        .whenComplete(
            (r, e) -> {
              try {
                if (e != null) {
                  resultHandler.onError(CheckedExceptionWrapper.wrap(e));
                  return;
                }
                WorkflowService.GetWorkflowExecutionHistory_result result =
                    r.getBody(WorkflowService.GetWorkflowExecutionHistory_result.class);

                if (r.getResponseCode() == ResponseCode.OK) {
                  GetWorkflowExecutionHistoryResponse res = result.getSuccess();
                  if (res.getRawHistory() != null) {
                    History history =
                        InternalUtils.DeserializeFromBlobDataToHistory(
                            res.getRawHistory(), getRequest.getHistoryEventFilterType());
                    res.setHistory(history);
                  }
                  resultHandler.onComplete(res);
                  return;
                }
                if (result.isSetBadRequestError()) {
                  resultHandler.onError(result.getBadRequestError());
                  return;
                }
                if (result.isSetEntityNotExistError()) {
                  resultHandler.onError(result.getEntityNotExistError());
                  return;
                }
                if (result.isSetServiceBusyError()) {
                  resultHandler.onError(result.getServiceBusyError());
                  return;
                }
                resultHandler.onError(
                    new TException(
                        "GetWorkflowExecutionHistory failed with unknown " + "error:" + result));
              } catch (TException tException) {
                resultHandler.onError(tException);
              } finally {
                if (r != null) {
                  r.release();
                }
              }
            })
        .exceptionally(
            (e) -> {
              log.error("Unexpected error in GetWorkflowExecutionHistory", e);
              return null;
            });
  }