Class TasksManager


  • public class TasksManager
    extends java.lang.Object
    • Field Detail

      • mainThreadExecutor

        public java.util.concurrent.Executor mainThreadExecutor
      • backgroundThreadExecutor

        public java.util.concurrent.Executor backgroundThreadExecutor
    • Method Detail

      • getInstance

        public static TasksManager getInstance()
        Factory method to obtain the Singleton instance of the TasksManager
      • executeOnMainThread

        public void executeOnMainThread​(java.lang.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

        public void cancelTaskOnMainThread​(java.lang.Runnable task)
        Utility method to cancel an ongoing main thread task
        Parameters:
        task - takes in task to be cancelled
      • executeOnBackgroundThread

        public void executeOnBackgroundThread​(java.lang.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

        public void cancelTaksOnBackgroundThread​(java.lang.Runnable task)
        Utility method to cancel an ongoing background thread task
        Parameters:
        task - takes in task to be cancelled