public class TasksManager
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
java.util.concurrent.Executor |
backgroundThreadExecutor |
java.util.concurrent.Executor |
mainThreadExecutor |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelTaksOnBackgroundThread(java.lang.Runnable task)
Utility method to cancel an ongoing background thread task
|
void |
cancelTaskOnMainThread(java.lang.Runnable task)
Utility method to cancel an ongoing main thread task
|
void |
executeOnBackgroundThread(java.lang.Runnable task)
This API can be used to execute code block on the background thread.
|
void |
executeOnMainThread(java.lang.Runnable task)
This API can be used to execute code block on the main thread.
|
static TasksManager |
getInstance()
Factory method to obtain the Singleton instance of the TasksManager
|
public java.util.concurrent.Executor mainThreadExecutor
public java.util.concurrent.Executor backgroundThreadExecutor
public static TasksManager getInstance()
public void executeOnMainThread(java.lang.Runnable task)
task - takes in task (to be executed on main thread) as a runnablepublic void cancelTaskOnMainThread(java.lang.Runnable task)
task - takes in task to be cancelledpublic void executeOnBackgroundThread(java.lang.Runnable task)
task - takes in task (to be executed on background thread) as a runnablepublic void cancelTaksOnBackgroundThread(java.lang.Runnable task)
task - takes in task to be cancelled