private void requestCancelWorkflowExecution()

in src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java [1319:1364]


  private void requestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest)
      throws TException {
    cancelRequest.setRequestId(UUID.randomUUID().toString());
    ThriftResponse<WorkflowService.RequestCancelWorkflowExecution_result> response = null;
    try {
      ThriftRequest<WorkflowService.RequestCancelWorkflowExecution_args> request =
          buildThriftRequest(
              "RequestCancelWorkflowExecution",
              new WorkflowService.RequestCancelWorkflowExecution_args(cancelRequest));
      response = doRemoteCall(request);
      WorkflowService.RequestCancelWorkflowExecution_result result =
          response.getBody(WorkflowService.RequestCancelWorkflowExecution_result.class);
      if (response.getResponseCode() == ResponseCode.OK) {
        return;
      }
      if (result.isSetBadRequestError()) {
        throw result.getBadRequestError();
      }
      if (result.isSetEntityNotExistError()) {
        throw result.getEntityNotExistError();
      }
      if (result.isSetWorkflowExecutionAlreadyCompletedError()) {
        throw result.getWorkflowExecutionAlreadyCompletedError();
      }
      if (result.isSetCancellationAlreadyRequestedError()) {
        throw result.getCancellationAlreadyRequestedError();
      }
      if (result.isSetServiceBusyError()) {
        throw result.getServiceBusyError();
      }
      if (result.isSetDomainNotActiveError()) {
        throw result.getDomainNotActiveError();
      }
      if (result.isSetLimitExceededError()) {
        throw result.getLimitExceededError();
      }
      if (result.isSetClientVersionNotSupportedError()) {
        throw result.getClientVersionNotSupportedError();
      }
      throw new TException("RequestCancelWorkflowExecution failed with unknown error:" + result);
    } finally {
      if (response != null) {
        response.release();
      }
    }
  }