-
@RestrictTo(value = RestrictTo.Scope.LIBRARY_GROUP) public class CTExecutors
Global executor pools per account.
Grouping tasks like this avoids the effects of task starvation (e.g. disk reads don't wait behind webservice requests).
-
-
Field Summary
Fields Modifier and Type Field Description public final IOExecutorIO_EXECUTORpublic final MainThreadExecutorMAIN_EXECUTORpublic final ExecutorCURRENT_THREAD_EXECUTORpublic final MainThreadExecutorDEFAULT_CALLBACK_EXECUTOR
-
Method Summary
Modifier and Type Method Description <TResult> Task<TResult>ioTask()Use this task when you want to offload some background task <TResult> Task<TResult>ioTaskNonUi()Use this task when you want to offload some background task <TResult> Task<TResult>ioTaskWithCallbackOnCurrentThread()Use this task when you want to offload some background task and receive callback on current thread <TResult> Task<TResult>mainTask()Use this task to execute a runnable to main thread <TResult> Task<TResult>postAsyncSafelyTask(String featureTag)Use this task to execute a job in a sequential fashion for a particular feature <TResult> Task<TResult>postAsyncSafelyTask()Common single thread pool for a particular account.Use this for general purpose single pipe-lining of jobs. <TResult> Task<TResult>taskOnExecutor(Executor taskExecutor, String taskName)Use this task to use your own custom executor for executing jobs & getting callbacks on default executors <TResult> Task<TResult>taskOnExecutorWithName(Executor taskExecutor, Executor callbackExecutor, String taskName)Use this task to use your own custom executor for executing jobs & getting callbacks on the provided callback executors -
-
Method Detail
-
ioTaskNonUi
<TResult> Task<TResult> ioTaskNonUi()
Use this task when you want to offload some background task
-
ioTaskWithCallbackOnCurrentThread
<TResult> Task<TResult> ioTaskWithCallbackOnCurrentThread()
Use this task when you want to offload some background task and receive callback on current thread
-
postAsyncSafelyTask
<TResult> Task<TResult> postAsyncSafelyTask(String featureTag)
Use this task to execute a job in a sequential fashion for a particular feature
- Parameters:
featureTag- - name of the feature.
-
postAsyncSafelyTask
<TResult> Task<TResult> postAsyncSafelyTask()
Common single thread pool for a particular account.Use this for general purpose single pipe-lining of jobs.
-
taskOnExecutor
<TResult> Task<TResult> taskOnExecutor(Executor taskExecutor, String taskName)
Use this task to use your own custom executor for executing jobs & getting callbacks on default executors
- Parameters:
taskExecutor- - executor on which the provided task will be executedtaskName- - custom name for the task (e.
-
taskOnExecutorWithName
<TResult> Task<TResult> taskOnExecutorWithName(Executor taskExecutor, Executor callbackExecutor, String taskName)
Use this task to use your own custom executor for executing jobs & getting callbacks on the provided callback executors
- Parameters:
taskExecutor- - executor on which the provided task will be executedcallbackExecutor- - executor on which the callbacks will be executedtaskName- - custom name for the task (e.
-
-
-
-