List Tasks API
editList Tasks API
editThe List Tasks API allows to get information about the tasks currently executing in the cluster.
List Tasks Request
editA ListTasksRequest
:
ListTasksRequest request = new ListTasksRequest();
There is no required parameters. By default the client will list all tasks and will not wait for task completion.
Parameters
editrequest.setActions("cluster:*"); request.setNodes("nodeId1", "nodeId2"); request.setParentTaskId(new TaskId("parentTaskId", 42));
Request only cluster-related tasks |
|
Request all tasks running on nodes nodeId1 and nodeId2 |
|
Request only children of a particular task |
Synchronous Execution
editListTasksResponse response = client.tasks().list(request, RequestOptions.DEFAULT);
Asynchronous Execution
editThe asynchronous execution of a cluster update settings requires both the
ListTasksRequest
instance and an ActionListener
instance to be
passed to the asynchronous method:
The asynchronous method does not block and returns immediately. Once it is
completed the ActionListener
is called back using the onResponse
method
if the execution successfully completed or using the onFailure
method if
it failed.
A typical listener for ListTasksResponse
looks like:
List Tasks Response
editMap<String, List<TaskInfo>> perNodeTasks = response.getPerNodeTasks(); List<TaskGroup> groups = response.getTaskGroups();