Class TaskExecutor

java.lang.Object
com.abubusoft.kripton.android.executor.TaskExecutor
Direct Known Subclasses:
KriptonDefaultTaskExecutor, KriptonTaskExecutor

public abstract class TaskExecutor extends 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 Details

    • TaskExecutor

      public TaskExecutor()
  • Method Details

    • executeOnDiskIO

      public abstract void executeOnDiskIO(@NonNull Runnable runnable)
      Executes the given task in the disk IO thread pool.
      Parameters:
      runnable - The runnable to run in the disk IO thread pool.
    • postToMainThread

      public abstract void postToMainThread(@NonNull Runnable runnable)
      Posts the given task to the main thread.
      Parameters:
      runnable - The runnable to run on the main thread.
    • executeOnMainThread

      public void executeOnMainThread(@NonNull Runnable runnable)
      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.