-
public class TaskQueueManages priority- and dependency-driven execution of background tasks.
The queue rejects re-adding tasks that are already scheduled or running — two tasks are considered equal if they are the same object, or share both TaskType and id. Subclasses control duplication semantics through the appropriate Task constructor; see com.appsflyer.internal.components.queue.tasks.UpdateRemoteControlTask for an example.
-
-
Constructor Summary
Constructors Constructor Description TaskQueue(ExecutorService mainExecutor)
-
Method Summary
Modifier and Type Method Description UnitaddTask(Task<?> task)UnitregisterListener(QueueStatusListener listener)UnitunRegisterListener(QueueStatusListener listener)UnitsetServiceExecutor(Executor serviceExecutor)Used by unit tests to force all reordering / add / drop operations onto a synchronous executor. BooleanshouldRetryInSession(Task<?> task)Whether task should be retried within the current session. List<Task<?>>getAllPendingTasks()Returns the tasks that will be run in the future (currently pending + failed-to-retry), sorted in the same order they're held in the queue. List<Task<?>>getBlockedTasks()Set<Task<?>>getRunningTasks()UnitclearAll()Removes every task from every internal collection. -
-
Constructor Detail
-
TaskQueue
TaskQueue(ExecutorService mainExecutor)
-
-
Method Detail
-
registerListener
Unit registerListener(QueueStatusListener listener)
-
unRegisterListener
Unit unRegisterListener(QueueStatusListener listener)
-
setServiceExecutor
Unit setServiceExecutor(Executor serviceExecutor)
Used by unit tests to force all reordering / add / drop operations onto a synchronous executor.
-
shouldRetryInSession
Boolean shouldRetryInSession(Task<?> task)
Whether task should be retried within the current session.
To prevent an infinite retry loop of cached ARS requests, those are retried at most once per session (the retry is only meaningful when the server is missing credentials).
-
getAllPendingTasks
List<Task<?>> getAllPendingTasks()
Returns the tasks that will be run in the future (currently pending + failed-to-retry), sorted in the same order they're held in the queue.
-
getBlockedTasks
List<Task<?>> getBlockedTasks()
-
getRunningTasks
Set<Task<?>> getRunningTasks()
-
-
-
-