algoliasearch/src/main/java/com/algolia/search/saas/Index.java
public Request waitTaskAsync(final @NonNull String taskID, @Nullable CompletionHandler completionHandler) {
        return getClient().new AsyncTaskRequest(completionHandler) {
            @NonNull
            @Override protected JSONObject run() throws AlgoliaException {
                return waitTask(taskID);
            }
        }.start();
    }
public Request waitTaskAsync(final @NonNull String taskID, @Nullable CompletionHandler completionHandler) {
        return getClient().new AsyncTaskRequest(completionHandler) {
            @NonNull
            @Override protected JSONObject run() throws AlgoliaException {
                return waitTask(taskID);
            }
        }.start();
    }
Wait until the publication of a task on the server (helper).
All server tasks are asynchronous. This method helps you check that a task is published.

@param taskID            Identifier of the task (as returned by the server).
@param completionHandler The listener that will be notified of the request's outcome.
@return A cancellable request.