public final UnaryCallable<DeleteTaskRequest, Empty> deleteTaskCallable() {
    return stub.deleteTaskCallable();
  }
Deletes a task.

<p>A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has
executed successfully or permanently failed.

<p>Sample code:

<pre>{@code
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
  DeleteTaskRequest request =
      DeleteTaskRequest.newBuilder()
          .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString())
          .build();
  ApiFuture<Empty> future = cloudTasksClient.deleteTaskCallable().futureCall(request);
  // Do something.
  future.get();
}
}</pre>
java-tasks/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2/CloudTasksClient.java