Class WorkerThread

    • Method Detail

      • start

        public final void start​(boolean paused)
        Starts execution of a new worker thread if not isRunning(), i.e. never #start()'ed or #stop()'ed.

        Method blocks until the new worker thread has been started and isRunning() and isActive() if paused == false.

        Parameters:
        paused - if true, keeps the new worker thread paused, otherwise resume() it.
      • stop

        public final void stop​(boolean waitUntilDone)
        Stops execution of the #start()'ed worker thread.

        Method blocks until worker thread has been stopped if waitUntilDone is true.

      • pause

        public final void pause​(boolean waitUntilDone)
        Pauses execution of the #start()'ed worker thread.

        Method blocks until worker thread has been isActive()'ated if waitUntilDone is true.

      • resume

        public final void resume()
        Resumes execution of the pause(boolean)'ed worker thread.
      • isRunning

        public final boolean isRunning()
        Returns true if the worker thread has started via #start() and has not ended, e.g. via #stop(). It might be paused.
      • isActive

        public final boolean isActive()
        Returns true if the worker thread isRunning() and is not paused.
      • isPaused

        public final boolean isPaused()
        Returns true if the worker thread isRunning() and is paused.
      • hasError

        public final boolean hasError()
        Returns true if an exception occured during Callable work execution.
      • getThread

        public final Thread getThread()
        Returns the worker thread if isRunning(), otherwise null.
      • getError

        public final Exception getError​(boolean clear)
        Returns the exception is hasError().
        Parameters:
        clear - if true, clear the exception
      • getMinPeriod

        public final java.time.Duration getMinPeriod()
        Returns enforced minimum work-loop-period or Duration.ZERO for none.
        See Also:
        getSleptDuration()
      • getMinDelay

        public final java.time.Duration getMinDelay()
        Returns enforced minimum work-loop-delay or Duration.ZERO for none.
        See Also:
        getSleptDuration()