-
public class TasksManager
-
-
Field Summary
Fields Modifier and Type Field Description private static TasksManagerinstancepublic ExecutormainThreadExecutorpublic ExecutorbackgroundThreadExecutor
-
Method Summary
Modifier and Type Method Description static synchronized TasksManagergetInstance()Factory method to obtain the Singleton instance of the TasksManager voidexecuteOnMainThread(Runnable task)This API can be used to execute code block on the main thread. voidcancelTaskOnMainThread(Runnable task)Utility method to cancel an ongoing main thread task voidexecuteOnBackgroundThread(Runnable task)This API can be used to execute code block on the background thread. voidcancelTaksOnBackgroundThread(Runnable task)Utility method to cancel an ongoing background thread task -
-
Method Detail
-
getInstance
static synchronized TasksManager getInstance()
Factory method to obtain the Singleton instance of the TasksManager
-
executeOnMainThread
void executeOnMainThread(Runnable task)
This API can be used to execute code block on the main thread.
- Parameters:
task- takes in task (to be executed on main thread) as a runnable
-
cancelTaskOnMainThread
void cancelTaskOnMainThread(Runnable task)
Utility method to cancel an ongoing main thread task
- Parameters:
task- takes in task to be cancelled
-
executeOnBackgroundThread
void executeOnBackgroundThread(Runnable task)
This API can be used to execute code block on the background thread.
- Parameters:
task- takes in task (to be executed on background thread) as a runnable
-
cancelTaksOnBackgroundThread
void cancelTaksOnBackgroundThread(Runnable task)
Utility method to cancel an ongoing background thread task
- Parameters:
task- takes in task to be cancelled
-
-
-
-