@SdkInternalApi
    final SendTaskFailureResult executeSendTaskFailure(SendTaskFailureRequest sendTaskFailureRequest) {

        ExecutionContext executionContext = createExecutionContext(sendTaskFailureRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<SendTaskFailureRequest> request = null;
        Response<SendTaskFailureResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new SendTaskFailureRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(sendTaskFailureRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SFN");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SendTaskFailure");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<SendTaskFailureResult>> responseHandler = protocolFactory.createResponseHandler(
                    new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SendTaskFailureResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }
<p>
Used by activity workers, Task states using the <a
href="https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token"
>callback</a> pattern, and optionally Task states using the <a
href="https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync">job run</a>
pattern to report that the task identified by the <code>taskToken</code> failed.
</p>
<p>
For an execution with encryption enabled, Step Functions will encrypt the error and cause fields using the KMS
key for the execution role.
</p>
<p>
A caller can mark a task as fail without using any KMS permissions in the execution role if the caller provides a
null value for both <code>error</code> and <code>cause</code> fields because no data needs to be encrypted.
</p>

@param sendTaskFailureRequest
@return Result of the SendTaskFailure operation returned by the service.
@throws TaskDoesNotExistException
        The activity does not exist.
@throws InvalidTokenException
        The provided token is not valid.
@throws TaskTimedOutException
        The task token has either expired or the task associated with the token has already been closed.
@throws KmsAccessDeniedException
        Either your KMS key policy or API caller does not have the required permissions.
@throws KmsInvalidStateException
        The KMS key is not in valid state, for example: Disabled or Deleted.
@throws KmsThrottlingException
        Received when KMS returns <code>ThrottlingException</code> for a KMS call that Step Functions makes on
        behalf of the caller.
@sample AWSStepFunctions.SendTaskFailure
@see <a href="http://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/SendTaskFailure" target="_top">AWS API
     Documentation</a>
aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/AWSStepFunctionsClient.java