Class TaskExecutor
java.lang.Object
com.abubusoft.kripton.android.executor.TaskExecutor
- Direct Known Subclasses:
KriptonDefaultTaskExecutor,KriptonTaskExecutor
public abstract class TaskExecutor
extends java.lang.Object
A task executor that can divide tasks into logical groups.
It holds a collection a executors for each group of task.
TODO: Don't use this from outside, we don't know what the API will look like yet.
-
Constructor Summary
Constructors Constructor Description TaskExecutor() -
Method Summary
Modifier and Type Method Description abstract voidexecuteOnDiskIO(java.lang.Runnable runnable)Executes the given task in the disk IO thread pool.voidexecuteOnMainThread(java.lang.Runnable runnable)Executes the given task on the main thread.abstract booleanisMainThread()Returns true if the current thread is the main thread, false otherwise.abstract voidpostToMainThread(java.lang.Runnable runnable)Posts the given task to the main thread.
-
Constructor Details
-
TaskExecutor
public TaskExecutor()
-
-
Method Details
-
executeOnDiskIO
Executes the given task in the disk IO thread pool.- Parameters:
runnable- The runnable to run in the disk IO thread pool.
-
postToMainThread
Posts the given task to the main thread.- Parameters:
runnable- The runnable to run on the main thread.
-
executeOnMainThread
Executes the given task on the main thread.If the current thread is a main thread, immediately runs the given runnable.
- Parameters:
runnable- The runnable to run on the main thread.
-
isMainThread
public abstract boolean isMainThread()Returns true if the current thread is the main thread, false otherwise.- Returns:
- true if we are on the main thread, false otherwise.
-