public final Task renewLease(String name, Timestamp scheduleTime, Duration leaseDuration) {
    RenewLeaseRequest request =
        RenewLeaseRequest.newBuilder()
            .setName(name)
            .setScheduleTime(scheduleTime)
            .setLeaseDuration(leaseDuration)
            .build();
    return renewLease(request);
  }
Renew the current lease of a pull task.

<p>The worker can use this method to extend the lease by a new duration, starting from now. The
new task lease will be returned in the task's
[schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time].

<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()) {
  String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString();
  Timestamp scheduleTime = Timestamp.newBuilder().build();
  Duration leaseDuration = Duration.newBuilder().build();
  Task response = cloudTasksClient.renewLease(name, scheduleTime, leaseDuration);
}
}</pre>

@param name Required. The task name. For example:
    `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
@param scheduleTime Required. The task's current schedule time, available in the
    [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by
    [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or
    [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response. This restriction
    is to ensure that your worker currently holds the lease.
@param leaseDuration Required. The desired new lease duration, starting from now.
    <p>The maximum lease duration is 1 week. `lease_duration` will be truncated to the nearest
    second.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
java-tasks/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2beta2/CloudTasksClient.java