@Generated(value="by gapic-generator") @BetaApi public class CloudTasksClient extends Object implements BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Queue response = cloudTasksClient.getQueue(name);
}
Note: close() needs to be called on the cloudTasksClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of CloudTasksSettings to create(). For example:
To customize credentials:
CloudTasksSettings cloudTasksSettings =
CloudTasksSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CloudTasksClient cloudTasksClient =
CloudTasksClient.create(cloudTasksSettings);
To customize the endpoint:
CloudTasksSettings cloudTasksSettings =
CloudTasksSettings.newBuilder().setEndpoint(myEndpoint).build();
CloudTasksClient cloudTasksClient =
CloudTasksClient.create(cloudTasksSettings);
Modifier and Type | Class and Description |
---|---|
static class |
CloudTasksClient.ListQueuesFixedSizeCollection |
static class |
CloudTasksClient.ListQueuesPage |
static class |
CloudTasksClient.ListQueuesPagedResponse |
static class |
CloudTasksClient.ListTasksFixedSizeCollection |
static class |
CloudTasksClient.ListTasksPage |
static class |
CloudTasksClient.ListTasksPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
CloudTasksClient(CloudTasksSettings settings)
Constructs an instance of CloudTasksClient, using the given settings.
|
protected |
CloudTasksClient(CloudTasksStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static CloudTasksClient |
create()
Constructs an instance of CloudTasksClient with default settings.
|
static CloudTasksClient |
create(CloudTasksSettings settings)
Constructs an instance of CloudTasksClient, using the given settings.
|
static CloudTasksClient |
create(CloudTasksStub stub)
Constructs an instance of CloudTasksClient, using the given stub for making calls.
|
com.google.cloud.tasks.v2.Queue |
createQueue(com.google.cloud.tasks.v2.CreateQueueRequest request)
Creates a queue.
|
com.google.cloud.tasks.v2.Queue |
createQueue(com.google.cloud.tasks.v2.LocationName parent,
com.google.cloud.tasks.v2.Queue queue)
Creates a queue.
|
com.google.cloud.tasks.v2.Queue |
createQueue(String parent,
com.google.cloud.tasks.v2.Queue queue)
Creates a queue.
|
UnaryCallable<com.google.cloud.tasks.v2.CreateQueueRequest,com.google.cloud.tasks.v2.Queue> |
createQueueCallable()
Creates a queue.
|
com.google.cloud.tasks.v2.Task |
createTask(com.google.cloud.tasks.v2.CreateTaskRequest request)
Creates a task and adds it to a queue.
|
com.google.cloud.tasks.v2.Task |
createTask(com.google.cloud.tasks.v2.QueueName parent,
com.google.cloud.tasks.v2.Task task)
Creates a task and adds it to a queue.
|
com.google.cloud.tasks.v2.Task |
createTask(String parent,
com.google.cloud.tasks.v2.Task task)
Creates a task and adds it to a queue.
|
UnaryCallable<com.google.cloud.tasks.v2.CreateTaskRequest,com.google.cloud.tasks.v2.Task> |
createTaskCallable()
Creates a task and adds it to a queue.
|
void |
deleteQueue(com.google.cloud.tasks.v2.DeleteQueueRequest request)
Deletes a queue.
|
void |
deleteQueue(com.google.cloud.tasks.v2.QueueName name)
Deletes a queue.
|
void |
deleteQueue(String name)
Deletes a queue.
|
UnaryCallable<com.google.cloud.tasks.v2.DeleteQueueRequest,Empty> |
deleteQueueCallable()
Deletes a queue.
|
void |
deleteTask(com.google.cloud.tasks.v2.DeleteTaskRequest request)
Deletes a task.
|
void |
deleteTask(String name)
Deletes a task.
|
void |
deleteTask(com.google.cloud.tasks.v2.TaskName name)
Deletes a task.
|
UnaryCallable<com.google.cloud.tasks.v2.DeleteTaskRequest,Empty> |
deleteTaskCallable()
Deletes a task.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.cloud.tasks.v2.QueueName resource)
Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
|
com.google.iam.v1.Policy |
getIamPolicy(String resource)
Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
|
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
|
com.google.cloud.tasks.v2.Queue |
getQueue(com.google.cloud.tasks.v2.GetQueueRequest request)
Gets a queue.
|
com.google.cloud.tasks.v2.Queue |
getQueue(com.google.cloud.tasks.v2.QueueName name)
Gets a queue.
|
com.google.cloud.tasks.v2.Queue |
getQueue(String name)
Gets a queue.
|
UnaryCallable<com.google.cloud.tasks.v2.GetQueueRequest,com.google.cloud.tasks.v2.Queue> |
getQueueCallable()
Gets a queue.
|
CloudTasksSettings |
getSettings() |
CloudTasksStub |
getStub() |
com.google.cloud.tasks.v2.Task |
getTask(com.google.cloud.tasks.v2.GetTaskRequest request)
Gets a task.
|
com.google.cloud.tasks.v2.Task |
getTask(String name)
Gets a task.
|
com.google.cloud.tasks.v2.Task |
getTask(com.google.cloud.tasks.v2.TaskName name)
Gets a task.
|
UnaryCallable<com.google.cloud.tasks.v2.GetTaskRequest,com.google.cloud.tasks.v2.Task> |
getTaskCallable()
Gets a task.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
CloudTasksClient.ListQueuesPagedResponse |
listQueues(com.google.cloud.tasks.v2.ListQueuesRequest request)
Lists queues.
|
CloudTasksClient.ListQueuesPagedResponse |
listQueues(com.google.cloud.tasks.v2.LocationName parent)
Lists queues.
|
CloudTasksClient.ListQueuesPagedResponse |
listQueues(String parent)
Lists queues.
|
UnaryCallable<com.google.cloud.tasks.v2.ListQueuesRequest,com.google.cloud.tasks.v2.ListQueuesResponse> |
listQueuesCallable()
Lists queues.
|
UnaryCallable<com.google.cloud.tasks.v2.ListQueuesRequest,CloudTasksClient.ListQueuesPagedResponse> |
listQueuesPagedCallable()
Lists queues.
|
CloudTasksClient.ListTasksPagedResponse |
listTasks(com.google.cloud.tasks.v2.ListTasksRequest request)
Lists the tasks in a queue.
|
CloudTasksClient.ListTasksPagedResponse |
listTasks(com.google.cloud.tasks.v2.QueueName parent)
Lists the tasks in a queue.
|
CloudTasksClient.ListTasksPagedResponse |
listTasks(String parent)
Lists the tasks in a queue.
|
UnaryCallable<com.google.cloud.tasks.v2.ListTasksRequest,com.google.cloud.tasks.v2.ListTasksResponse> |
listTasksCallable()
Lists the tasks in a queue.
|
UnaryCallable<com.google.cloud.tasks.v2.ListTasksRequest,CloudTasksClient.ListTasksPagedResponse> |
listTasksPagedCallable()
Lists the tasks in a queue.
|
com.google.cloud.tasks.v2.Queue |
pauseQueue(com.google.cloud.tasks.v2.PauseQueueRequest request)
Pauses the queue.
|
com.google.cloud.tasks.v2.Queue |
pauseQueue(com.google.cloud.tasks.v2.QueueName name)
Pauses the queue.
|
com.google.cloud.tasks.v2.Queue |
pauseQueue(String name)
Pauses the queue.
|
UnaryCallable<com.google.cloud.tasks.v2.PauseQueueRequest,com.google.cloud.tasks.v2.Queue> |
pauseQueueCallable()
Pauses the queue.
|
com.google.cloud.tasks.v2.Queue |
purgeQueue(com.google.cloud.tasks.v2.PurgeQueueRequest request)
Purges a queue by deleting all of its tasks.
|
com.google.cloud.tasks.v2.Queue |
purgeQueue(com.google.cloud.tasks.v2.QueueName name)
Purges a queue by deleting all of its tasks.
|
com.google.cloud.tasks.v2.Queue |
purgeQueue(String name)
Purges a queue by deleting all of its tasks.
|
UnaryCallable<com.google.cloud.tasks.v2.PurgeQueueRequest,com.google.cloud.tasks.v2.Queue> |
purgeQueueCallable()
Purges a queue by deleting all of its tasks.
|
com.google.cloud.tasks.v2.Queue |
resumeQueue(com.google.cloud.tasks.v2.QueueName name)
Resume a queue.
|
com.google.cloud.tasks.v2.Queue |
resumeQueue(com.google.cloud.tasks.v2.ResumeQueueRequest request)
Resume a queue.
|
com.google.cloud.tasks.v2.Queue |
resumeQueue(String name)
Resume a queue.
|
UnaryCallable<com.google.cloud.tasks.v2.ResumeQueueRequest,com.google.cloud.tasks.v2.Queue> |
resumeQueueCallable()
Resume a queue.
|
com.google.cloud.tasks.v2.Task |
runTask(com.google.cloud.tasks.v2.RunTaskRequest request)
Forces a task to run now.
|
com.google.cloud.tasks.v2.Task |
runTask(String name)
Forces a task to run now.
|
com.google.cloud.tasks.v2.Task |
runTask(com.google.cloud.tasks.v2.TaskName name)
Forces a task to run now.
|
UnaryCallable<com.google.cloud.tasks.v2.RunTaskRequest,com.google.cloud.tasks.v2.Task> |
runTaskCallable()
Forces a task to run now.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.cloud.tasks.v2.QueueName resource,
com.google.iam.v1.Policy policy)
Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
|
com.google.iam.v1.Policy |
setIamPolicy(String resource,
com.google.iam.v1.Policy policy)
Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
|
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.cloud.tasks.v2.QueueName resource,
List<String> permissions)
Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2.Queue].
|
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(String resource,
List<String> permissions)
Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2.Queue].
|
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2.Queue].
|
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2.Queue].
|
com.google.cloud.tasks.v2.Queue |
updateQueue(com.google.cloud.tasks.v2.Queue queue,
FieldMask updateMask)
Updates a queue.
|
com.google.cloud.tasks.v2.Queue |
updateQueue(com.google.cloud.tasks.v2.UpdateQueueRequest request)
Updates a queue.
|
UnaryCallable<com.google.cloud.tasks.v2.UpdateQueueRequest,com.google.cloud.tasks.v2.Queue> |
updateQueueCallable()
Updates a queue.
|
protected CloudTasksClient(CloudTasksSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected CloudTasksClient(CloudTasksStub stub)
public static final CloudTasksClient create() throws IOException
IOException
public static final CloudTasksClient create(CloudTasksSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final CloudTasksClient create(CloudTasksStub stub)
public final CloudTasksSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public CloudTasksStub getStub()
public final CloudTasksClient.ListQueuesPagedResponse listQueues(com.google.cloud.tasks.v2.LocationName parent)
Queues are returned in lexicographical order.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Queue element : cloudTasksClient.listQueues(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
The location name. For example: `projects/PROJECT_ID/locations/LOCATION_ID`
ApiException
- if the remote call failspublic final CloudTasksClient.ListQueuesPagedResponse listQueues(String parent)
Queues are returned in lexicographical order.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Queue element : cloudTasksClient.listQueues(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
The location name. For example: `projects/PROJECT_ID/locations/LOCATION_ID`
ApiException
- if the remote call failspublic final CloudTasksClient.ListQueuesPagedResponse listQueues(com.google.cloud.tasks.v2.ListQueuesRequest request)
Queues are returned in lexicographical order.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListQueuesRequest request = ListQueuesRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Queue element : cloudTasksClient.listQueues(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.ListQueuesRequest,CloudTasksClient.ListQueuesPagedResponse> listQueuesPagedCallable()
Queues are returned in lexicographical order.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListQueuesRequest request = ListQueuesRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListQueuesPagedResponse> future = cloudTasksClient.listQueuesPagedCallable().futureCall(request);
// Do something
for (Queue element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.tasks.v2.ListQueuesRequest,com.google.cloud.tasks.v2.ListQueuesResponse> listQueuesCallable()
Queues are returned in lexicographical order.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListQueuesRequest request = ListQueuesRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListQueuesResponse response = cloudTasksClient.listQueuesCallable().call(request);
for (Queue element : response.getQueuesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.tasks.v2.Queue getQueue(com.google.cloud.tasks.v2.QueueName name)
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Queue response = cloudTasksClient.getQueue(name);
}
name
- Required.
The resource name of the queue. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue getQueue(String name)
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Queue response = cloudTasksClient.getQueue(name.toString());
}
name
- Required.
The resource name of the queue. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue getQueue(com.google.cloud.tasks.v2.GetQueueRequest request)
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
GetQueueRequest request = GetQueueRequest.newBuilder()
.setName(name.toString())
.build();
Queue response = cloudTasksClient.getQueue(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.GetQueueRequest,com.google.cloud.tasks.v2.Queue> getQueueCallable()
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
GetQueueRequest request = GetQueueRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Queue> future = cloudTasksClient.getQueueCallable().futureCall(request);
// Do something
Queue response = future.get();
}
public final com.google.cloud.tasks.v2.Queue createQueue(com.google.cloud.tasks.v2.LocationName parent, com.google.cloud.tasks.v2.Queue queue)
Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Queue queue = Queue.newBuilder().build();
Queue response = cloudTasksClient.createQueue(parent, queue);
}
parent
- Required.
The location name in which the queue will be created. For example: `projects/PROJECT_ID/locations/LOCATION_ID`
The list of allowed locations can be obtained by calling Cloud Tasks' implementation of [ListLocations][google.cloud.location.Locations.ListLocations].
queue
- Required.
The queue to create.
[Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an existing queue.
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue createQueue(String parent, com.google.cloud.tasks.v2.Queue queue)
Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Queue queue = Queue.newBuilder().build();
Queue response = cloudTasksClient.createQueue(parent.toString(), queue);
}
parent
- Required.
The location name in which the queue will be created. For example: `projects/PROJECT_ID/locations/LOCATION_ID`
The list of allowed locations can be obtained by calling Cloud Tasks' implementation of [ListLocations][google.cloud.location.Locations.ListLocations].
queue
- Required.
The queue to create.
[Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an existing queue.
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue createQueue(com.google.cloud.tasks.v2.CreateQueueRequest request)
Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Queue queue = Queue.newBuilder().build();
CreateQueueRequest request = CreateQueueRequest.newBuilder()
.setParent(parent.toString())
.setQueue(queue)
.build();
Queue response = cloudTasksClient.createQueue(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.CreateQueueRequest,com.google.cloud.tasks.v2.Queue> createQueueCallable()
Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Queue queue = Queue.newBuilder().build();
CreateQueueRequest request = CreateQueueRequest.newBuilder()
.setParent(parent.toString())
.setQueue(queue)
.build();
ApiFuture<Queue> future = cloudTasksClient.createQueueCallable().futureCall(request);
// Do something
Queue response = future.get();
}
public final com.google.cloud.tasks.v2.Queue updateQueue(com.google.cloud.tasks.v2.Queue queue, FieldMask updateMask)
This method creates the queue if it does not exist and updates the queue if it does exist.
Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
Queue queue = Queue.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Queue response = cloudTasksClient.updateQueue(queue, updateMask);
}
queue
- Required.
The queue to create or update.
The queue's [name][google.cloud.tasks.v2.Queue.name] must be specified.
Output only fields cannot be modified using UpdateQueue. Any value specified for an output only field will be ignored. The queue's [name][google.cloud.tasks.v2.Queue.name] cannot be changed.
updateMask
- A mask used to specify which fields of the queue are being updated.
If empty, then all fields will be updated.
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue updateQueue(com.google.cloud.tasks.v2.UpdateQueueRequest request)
This method creates the queue if it does not exist and updates the queue if it does exist.
Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
Queue queue = Queue.newBuilder().build();
UpdateQueueRequest request = UpdateQueueRequest.newBuilder()
.setQueue(queue)
.build();
Queue response = cloudTasksClient.updateQueue(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.UpdateQueueRequest,com.google.cloud.tasks.v2.Queue> updateQueueCallable()
This method creates the queue if it does not exist and updates the queue if it does exist.
Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
Queue queue = Queue.newBuilder().build();
UpdateQueueRequest request = UpdateQueueRequest.newBuilder()
.setQueue(queue)
.build();
ApiFuture<Queue> future = cloudTasksClient.updateQueueCallable().futureCall(request);
// Do something
Queue response = future.get();
}
public final void deleteQueue(com.google.cloud.tasks.v2.QueueName name)
This command will delete the queue even if it has tasks in it.
Note: If you delete a queue, a queue with the same name can't be created for 7 days.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
cloudTasksClient.deleteQueue(name);
}
name
- Required.
The queue name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final void deleteQueue(String name)
This command will delete the queue even if it has tasks in it.
Note: If you delete a queue, a queue with the same name can't be created for 7 days.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
cloudTasksClient.deleteQueue(name.toString());
}
name
- Required.
The queue name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final void deleteQueue(com.google.cloud.tasks.v2.DeleteQueueRequest request)
This command will delete the queue even if it has tasks in it.
Note: If you delete a queue, a queue with the same name can't be created for 7 days.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
DeleteQueueRequest request = DeleteQueueRequest.newBuilder()
.setName(name.toString())
.build();
cloudTasksClient.deleteQueue(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.DeleteQueueRequest,Empty> deleteQueueCallable()
This command will delete the queue even if it has tasks in it.
Note: If you delete a queue, a queue with the same name can't be created for 7 days.
WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
DeleteQueueRequest request = DeleteQueueRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = cloudTasksClient.deleteQueueCallable().futureCall(request);
// Do something
future.get();
}
public final com.google.cloud.tasks.v2.Queue purgeQueue(com.google.cloud.tasks.v2.QueueName name)
All tasks created before this method is called are permanently deleted.
Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Queue response = cloudTasksClient.purgeQueue(name);
}
name
- Required.
The queue name. For example: `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue purgeQueue(String name)
All tasks created before this method is called are permanently deleted.
Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Queue response = cloudTasksClient.purgeQueue(name.toString());
}
name
- Required.
The queue name. For example: `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue purgeQueue(com.google.cloud.tasks.v2.PurgeQueueRequest request)
All tasks created before this method is called are permanently deleted.
Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
PurgeQueueRequest request = PurgeQueueRequest.newBuilder()
.setName(name.toString())
.build();
Queue response = cloudTasksClient.purgeQueue(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.PurgeQueueRequest,com.google.cloud.tasks.v2.Queue> purgeQueueCallable()
All tasks created before this method is called are permanently deleted.
Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
PurgeQueueRequest request = PurgeQueueRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Queue> future = cloudTasksClient.purgeQueueCallable().futureCall(request);
// Do something
Queue response = future.get();
}
public final com.google.cloud.tasks.v2.Queue pauseQueue(com.google.cloud.tasks.v2.QueueName name)
If a queue is paused then the system will stop dispatching tasks until the queue is resumed via [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can still be added when the queue is paused. A queue is paused if its [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Queue response = cloudTasksClient.pauseQueue(name);
}
name
- Required.
The queue name. For example: `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue pauseQueue(String name)
If a queue is paused then the system will stop dispatching tasks until the queue is resumed via [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can still be added when the queue is paused. A queue is paused if its [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Queue response = cloudTasksClient.pauseQueue(name.toString());
}
name
- Required.
The queue name. For example: `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue pauseQueue(com.google.cloud.tasks.v2.PauseQueueRequest request)
If a queue is paused then the system will stop dispatching tasks until the queue is resumed via [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can still be added when the queue is paused. A queue is paused if its [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
PauseQueueRequest request = PauseQueueRequest.newBuilder()
.setName(name.toString())
.build();
Queue response = cloudTasksClient.pauseQueue(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.PauseQueueRequest,com.google.cloud.tasks.v2.Queue> pauseQueueCallable()
If a queue is paused then the system will stop dispatching tasks until the queue is resumed via [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can still be added when the queue is paused. A queue is paused if its [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
PauseQueueRequest request = PauseQueueRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Queue> future = cloudTasksClient.pauseQueueCallable().futureCall(request);
// Do something
Queue response = future.get();
}
public final com.google.cloud.tasks.v2.Queue resumeQueue(com.google.cloud.tasks.v2.QueueName name)
This method resumes a queue after it has been [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it will be set to [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING].
WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Queue response = cloudTasksClient.resumeQueue(name);
}
name
- Required.
The queue name. For example: `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue resumeQueue(String name)
This method resumes a queue after it has been [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it will be set to [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING].
WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Queue response = cloudTasksClient.resumeQueue(name.toString());
}
name
- Required.
The queue name. For example: `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Queue resumeQueue(com.google.cloud.tasks.v2.ResumeQueueRequest request)
This method resumes a queue after it has been [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it will be set to [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING].
WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
ResumeQueueRequest request = ResumeQueueRequest.newBuilder()
.setName(name.toString())
.build();
Queue response = cloudTasksClient.resumeQueue(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.ResumeQueueRequest,com.google.cloud.tasks.v2.Queue> resumeQueueCallable()
This method resumes a queue after it has been [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it will be set to [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING].
WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
ResumeQueueRequest request = ResumeQueueRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Queue> future = cloudTasksClient.resumeQueueCallable().futureCall(request);
// Do something
Queue response = future.get();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.cloud.tasks.v2.QueueName resource)
Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent:
* `cloudtasks.queues.getIamPolicy`
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Policy response = cloudTasksClient.getIamPolicy(resource);
}
resource
- REQUIRED: The resource for which the policy is being requested. `resource` is
usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy getIamPolicy(String resource)
Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent:
* `cloudtasks.queues.getIamPolicy`
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Policy response = cloudTasksClient.getIamPolicy(resource.toString());
}
resource
- REQUIRED: The resource for which the policy is being requested. `resource` is
usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent:
* `cloudtasks.queues.getIamPolicy`
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
.setResource(resource.toString())
.build();
Policy response = cloudTasksClient.getIamPolicy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent:
* `cloudtasks.queues.getIamPolicy`
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
.setResource(resource.toString())
.build();
ApiFuture<Policy> future = cloudTasksClient.getIamPolicyCallable().futureCall(request);
// Do something
Policy response = future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.cloud.tasks.v2.QueueName resource, com.google.iam.v1.Policy policy)
Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level permissions are required to use the Cloud Console.
Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent:
* `cloudtasks.queues.setIamPolicy`
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Policy policy = Policy.newBuilder().build();
Policy response = cloudTasksClient.setIamPolicy(resource, policy);
}
resource
- REQUIRED: The resource for which the policy is being specified. `resource` is
usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.policy
- REQUIRED: The complete policy to be applied to the `resource`. The size of the
policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
Platform services (such as Projects) might reject them.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy setIamPolicy(String resource, com.google.iam.v1.Policy policy)
Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level permissions are required to use the Cloud Console.
Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent:
* `cloudtasks.queues.setIamPolicy`
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Policy policy = Policy.newBuilder().build();
Policy response = cloudTasksClient.setIamPolicy(resource.toString(), policy);
}
resource
- REQUIRED: The resource for which the policy is being specified. `resource` is
usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.policy
- REQUIRED: The complete policy to be applied to the `resource`. The size of the
policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
Platform services (such as Projects) might reject them.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level permissions are required to use the Cloud Console.
Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent:
* `cloudtasks.queues.setIamPolicy`
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Policy policy = Policy.newBuilder().build();
SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
.setResource(resource.toString())
.setPolicy(policy)
.build();
Policy response = cloudTasksClient.setIamPolicy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level permissions are required to use the Cloud Console.
Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent:
* `cloudtasks.queues.setIamPolicy`
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Policy policy = Policy.newBuilder().build();
SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
.setResource(resource.toString())
.setPolicy(policy)
.build();
ApiFuture<Policy> future = cloudTasksClient.setIamPolicyCallable().futureCall(request);
// Do something
Policy response = future.get();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.cloud.tasks.v2.QueueName resource, List<String> permissions)
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse response = cloudTasksClient.testIamPermissions(resource, permissions);
}
resource
- REQUIRED: The resource for which the policy detail is being requested.
`resource` is usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.permissions
- The set of permissions to check for the `resource`. Permissions with
wildcards (such as '*' or 'storage.*') are not allowed. For more information see
[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).ApiException
- if the remote call failspublic final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(String resource, List<String> permissions)
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse response = cloudTasksClient.testIamPermissions(resource.toString(), permissions);
}
resource
- REQUIRED: The resource for which the policy detail is being requested.
`resource` is usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.permissions
- The set of permissions to check for the `resource`. Permissions with
wildcards (such as '*' or 'storage.*') are not allowed. For more information see
[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).ApiException
- if the remote call failspublic final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
.setResource(resource.toString())
.addAllPermissions(permissions)
.build();
TestIamPermissionsResponse response = cloudTasksClient.testIamPermissions(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
.setResource(resource.toString())
.addAllPermissions(permissions)
.build();
ApiFuture<TestIamPermissionsResponse> future = cloudTasksClient.testIamPermissionsCallable().futureCall(request);
// Do something
TestIamPermissionsResponse response = future.get();
}
public final CloudTasksClient.ListTasksPagedResponse listTasks(com.google.cloud.tasks.v2.QueueName parent)
By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view] controls the subset of information which is returned.
The tasks may be returned in any order. The ordering may change at any time.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
for (Task element : cloudTasksClient.listTasks(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
The queue name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final CloudTasksClient.ListTasksPagedResponse listTasks(String parent)
By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view] controls the subset of information which is returned.
The tasks may be returned in any order. The ordering may change at any time.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
for (Task element : cloudTasksClient.listTasks(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
The queue name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
ApiException
- if the remote call failspublic final CloudTasksClient.ListTasksPagedResponse listTasks(com.google.cloud.tasks.v2.ListTasksRequest request)
By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view] controls the subset of information which is returned.
The tasks may be returned in any order. The ordering may change at any time.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
ListTasksRequest request = ListTasksRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Task element : cloudTasksClient.listTasks(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.ListTasksRequest,CloudTasksClient.ListTasksPagedResponse> listTasksPagedCallable()
By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view] controls the subset of information which is returned.
The tasks may be returned in any order. The ordering may change at any time.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
ListTasksRequest request = ListTasksRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListTasksPagedResponse> future = cloudTasksClient.listTasksPagedCallable().futureCall(request);
// Do something
for (Task element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.tasks.v2.ListTasksRequest,com.google.cloud.tasks.v2.ListTasksResponse> listTasksCallable()
By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view] controls the subset of information which is returned.
The tasks may be returned in any order. The ordering may change at any time.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
ListTasksRequest request = ListTasksRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListTasksResponse response = cloudTasksClient.listTasksCallable().call(request);
for (Task element : response.getTasksList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.tasks.v2.Task getTask(com.google.cloud.tasks.v2.TaskName name)
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
Task response = cloudTasksClient.getTask(name);
}
name
- Required.
The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Task getTask(String name)
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
Task response = cloudTasksClient.getTask(name.toString());
}
name
- Required.
The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Task getTask(com.google.cloud.tasks.v2.GetTaskRequest request)
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
GetTaskRequest request = GetTaskRequest.newBuilder()
.setName(name.toString())
.build();
Task response = cloudTasksClient.getTask(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.GetTaskRequest,com.google.cloud.tasks.v2.Task> getTaskCallable()
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
GetTaskRequest request = GetTaskRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Task> future = cloudTasksClient.getTaskCallable().futureCall(request);
// Do something
Task response = future.get();
}
public final com.google.cloud.tasks.v2.Task createTask(com.google.cloud.tasks.v2.QueueName parent, com.google.cloud.tasks.v2.Task task)
Tasks cannot be updated after creation; there is no UpdateTask command.
* For [App Engine queues][google.cloud.tasks.v2.AppEngineHttpQueue], the maximum task size is 100KB.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Task task = Task.newBuilder().build();
Task response = cloudTasksClient.createTask(parent, task);
}
parent
- Required.
The queue name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
The queue must already exist.
task
- Required.
The task to add.
Task names have the following format: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. The user can optionally specify a task [name][google.cloud.tasks.v2.Task.name]. If a name is not specified then the system will generate a random unique task id, which will be set in the task returned in the [response][google.cloud.tasks.v2.Task.name].
If [schedule_time][google.cloud.tasks.v2.Task.schedule_time] is not set or is in the past then Cloud Tasks will set it to the current time.
Task De-duplication:
Explicitly specifying a task ID enables task de-duplication. If a task's ID is identical to that of an existing task or a task that was deleted or executed recently then the call will fail with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS]. If the task's queue was created using Cloud Tasks, then another task with the same name can't be created for ~1hour after the original task was deleted or executed. If the task's queue was created using queue.yaml or queue.xml, then another task with the same name can't be created for ~9days after the original task was deleted or executed.
Because there is an extra lookup cost to identify duplicate task names, these [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] calls have significantly increased latency. Using hashed strings for the task id or for the prefix of the task id is recommended. Choosing task ids that are sequential or have sequential prefixes, for example using a timestamp, causes an increase in latency and error rates in all task commands. The infrastructure relies on an approximately uniform distribution of task ids to store and serve tasks efficiently.
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Task createTask(String parent, com.google.cloud.tasks.v2.Task task)
Tasks cannot be updated after creation; there is no UpdateTask command.
* For [App Engine queues][google.cloud.tasks.v2.AppEngineHttpQueue], the maximum task size is 100KB.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Task task = Task.newBuilder().build();
Task response = cloudTasksClient.createTask(parent.toString(), task);
}
parent
- Required.
The queue name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
The queue must already exist.
task
- Required.
The task to add.
Task names have the following format: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. The user can optionally specify a task [name][google.cloud.tasks.v2.Task.name]. If a name is not specified then the system will generate a random unique task id, which will be set in the task returned in the [response][google.cloud.tasks.v2.Task.name].
If [schedule_time][google.cloud.tasks.v2.Task.schedule_time] is not set or is in the past then Cloud Tasks will set it to the current time.
Task De-duplication:
Explicitly specifying a task ID enables task de-duplication. If a task's ID is identical to that of an existing task or a task that was deleted or executed recently then the call will fail with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS]. If the task's queue was created using Cloud Tasks, then another task with the same name can't be created for ~1hour after the original task was deleted or executed. If the task's queue was created using queue.yaml or queue.xml, then another task with the same name can't be created for ~9days after the original task was deleted or executed.
Because there is an extra lookup cost to identify duplicate task names, these [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] calls have significantly increased latency. Using hashed strings for the task id or for the prefix of the task id is recommended. Choosing task ids that are sequential or have sequential prefixes, for example using a timestamp, causes an increase in latency and error rates in all task commands. The infrastructure relies on an approximately uniform distribution of task ids to store and serve tasks efficiently.
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Task createTask(com.google.cloud.tasks.v2.CreateTaskRequest request)
Tasks cannot be updated after creation; there is no UpdateTask command.
* For [App Engine queues][google.cloud.tasks.v2.AppEngineHttpQueue], the maximum task size is 100KB.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Task task = Task.newBuilder().build();
CreateTaskRequest request = CreateTaskRequest.newBuilder()
.setParent(parent.toString())
.setTask(task)
.build();
Task response = cloudTasksClient.createTask(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.CreateTaskRequest,com.google.cloud.tasks.v2.Task> createTaskCallable()
Tasks cannot be updated after creation; there is no UpdateTask command.
* For [App Engine queues][google.cloud.tasks.v2.AppEngineHttpQueue], the maximum task size is 100KB.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Task task = Task.newBuilder().build();
CreateTaskRequest request = CreateTaskRequest.newBuilder()
.setParent(parent.toString())
.setTask(task)
.build();
ApiFuture<Task> future = cloudTasksClient.createTaskCallable().futureCall(request);
// Do something
Task response = future.get();
}
public final void deleteTask(com.google.cloud.tasks.v2.TaskName name)
A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has executed successfully or permanently failed.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
cloudTasksClient.deleteTask(name);
}
name
- Required.
The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
ApiException
- if the remote call failspublic final void deleteTask(String name)
A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has executed successfully or permanently failed.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
cloudTasksClient.deleteTask(name.toString());
}
name
- Required.
The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
ApiException
- if the remote call failspublic final void deleteTask(com.google.cloud.tasks.v2.DeleteTaskRequest request)
A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has executed successfully or permanently failed.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
DeleteTaskRequest request = DeleteTaskRequest.newBuilder()
.setName(name.toString())
.build();
cloudTasksClient.deleteTask(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.DeleteTaskRequest,Empty> deleteTaskCallable()
A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has executed successfully or permanently failed.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
DeleteTaskRequest request = DeleteTaskRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = cloudTasksClient.deleteTaskCallable().futureCall(request);
// Do something
future.get();
}
public final com.google.cloud.tasks.v2.Task runTask(com.google.cloud.tasks.v2.TaskName name)
When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits] or is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
This command is meant to be used for manual debugging. For example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now.
The dispatched task is returned. That is, the task that is returned contains the [status][Task.status] after the task is dispatched but before the task is received by its target.
If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to the time that [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was called plus the retry delay specified in the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig].
[RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a task that has already succeeded or permanently failed.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
Task response = cloudTasksClient.runTask(name);
}
name
- Required.
The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Task runTask(String name)
When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits] or is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
This command is meant to be used for manual debugging. For example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now.
The dispatched task is returned. That is, the task that is returned contains the [status][Task.status] after the task is dispatched but before the task is received by its target.
If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to the time that [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was called plus the retry delay specified in the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig].
[RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a task that has already succeeded or permanently failed.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
Task response = cloudTasksClient.runTask(name.toString());
}
name
- Required.
The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
ApiException
- if the remote call failspublic final com.google.cloud.tasks.v2.Task runTask(com.google.cloud.tasks.v2.RunTaskRequest request)
When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits] or is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
This command is meant to be used for manual debugging. For example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now.
The dispatched task is returned. That is, the task that is returned contains the [status][Task.status] after the task is dispatched but before the task is received by its target.
If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to the time that [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was called plus the retry delay specified in the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig].
[RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a task that has already succeeded or permanently failed.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
RunTaskRequest request = RunTaskRequest.newBuilder()
.setName(name.toString())
.build();
Task response = cloudTasksClient.runTask(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.tasks.v2.RunTaskRequest,com.google.cloud.tasks.v2.Task> runTaskCallable()
When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits] or is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
This command is meant to be used for manual debugging. For example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now.
The dispatched task is returned. That is, the task that is returned contains the [status][Task.status] after the task is dispatched but before the task is received by its target.
If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to the time that [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was called plus the retry delay specified in the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig].
[RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a task that has already succeeded or permanently failed.
Sample code:
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
RunTaskRequest request = RunTaskRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Task> future = cloudTasksClient.runTaskCallable().futureCall(request);
// Do something
Task response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.