Tasks

public final class Tasks
extends Object

java.lang.Object
   ↳ com.google.android.play.core.tasks.Tasks


Task utility methods.

Summary

Public methods

static <ResultT> ResultT await(Task<ResultT> task, long timeout, TimeUnit unit)

Blocks until the specified Task is complete.

static <ResultT> ResultT await(Task<ResultT> task)

Blocks until the specified Task is complete.

static Task<Void> whenAll(Collection<? extends Task<?>> tasks)

Returns a Task that completes successfully when all of the specified Tasks complete successfully.

Inherited methods

Public methods

await

public static ResultT await (Task<ResultT> task, 
                long timeout, 
                TimeUnit unit)

Blocks until the specified Task is complete.

Parameters
task Task

timeout long

unit TimeUnit

Returns
ResultT the Task's result

Throws
ExecutionException if the Task fails
InterruptedException if an interrupt occurs while waiting for the Task to complete
TimeoutException if the specified timeout is reached before the Task completes

await

public static ResultT await (Task<ResultT> task)

Blocks until the specified Task is complete.

Parameters
task Task

Returns
ResultT the Task's result

Throws
ExecutionException if the Task fails
InterruptedException if an interrupt occurs while waiting for the Task to complete

whenAll

public static Task<Void> whenAll (Collection<? extends Task<?>> tasks)

Returns a Task that completes successfully when all of the specified Tasks complete successfully. Does not accept nulls.

The returned Task would fail if any of the provided Tasks fail.

Parameters
tasks Collection

Returns
Task<Void>

Throws
NullPointerException if any of the provided Tasks are null