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 void executeOnDiskIO​(java.lang.Runnable runnable)
    Executes the given task in the disk IO thread pool.
    void executeOnMainThread​(java.lang.Runnable runnable)
    Executes the given task on the main thread.
    abstract boolean isMainThread()
    Returns true if the current thread is the main thread, false otherwise.
    abstract void postToMainThread​(java.lang.Runnable runnable)
    Posts the given task to the main thread.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • executeOnDiskIO

      public abstract void executeOnDiskIO​(@NonNull java.lang.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 java.lang.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 java.lang.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.