Class SimpleThread

    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleThread​(java.lang.String threadName)
      Create an instance of the SimpleThread
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected SimpleThreadHandler constructHandler()  
      void runAndWaitForFinish​(java.lang.Runnable runnable)
      Add a task to the queue and wait when task will be completed
      <T> T runAndWaitForResult​(java.util.concurrent.Callable<T> callable)
      Add a task to the queue and wait when task will be completed
      void runAsync​(java.lang.Runnable runnable)
      Add a task to the queue and run the task asynchronously
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SimpleThread

        public SimpleThread​(@NonNull
                            java.lang.String threadName)
        Create an instance of the SimpleThread
        Parameters:
        threadName - name of the current thread
    • Method Detail

      • runAsync

        public void runAsync​(java.lang.Runnable runnable)
        Add a task to the queue and run the task asynchronously
      • runAndWaitForResult

        @Nullable
        public <T> T runAndWaitForResult​(java.util.concurrent.Callable<T> callable)
        Add a task to the queue and wait when task will be completed
        Returns:
        result of the task
      • runAndWaitForFinish

        public void runAndWaitForFinish​(java.lang.Runnable runnable)
        Add a task to the queue and wait when task will be completed