Class SPRunner<T>

  • All Implemented Interfaces:
    RMPropertyChanger, java.lang.Cloneable
    Direct Known Subclasses:
    SwingRunner

    public abstract class SPRunner<T>
    extends RMObject
    A class for running operations in the background.
    • Constructor Detail

      • SPRunner

        public SPRunner()
    • Method Detail

      • getProgress

        public double getProgress()
        Returns the progress value.
      • setProgress

        public void setProgress​(double aValue)
        Sets the progress value.
      • getName

        public java.lang.String getName()
        Returns the name of runner (and thread).
      • setName

        public void setName​(java.lang.String aName)
        Sets the name of runner (and thread).
      • getActivityText

        public java.lang.String getActivityText()
        Returns a description of the current activity beging performed.
      • setActivityText

        public void setActivityText​(java.lang.String aString)
        Sets a description of the current activity beging performed.
      • setStatus

        protected void setStatus​(SPRunner.Status aStatus)
        Sets the status.
      • getThread

        public java.lang.Thread getThread()
        Returns the thread.
      • join

        public SPRunner<T> join()
        Joins the runner.
      • join

        public SPRunner<T> join​(int aTimeout)
        Joins the runner.
      • isActive

        public boolean isActive()
        Returns whether thread is still active.
      • isCancelled

        public boolean isCancelled()
        Whether runner has been cancelled.
      • getStartTime

        public long getStartTime()
        Returns the start time.
      • getEndTime

        public long getEndTime()
        Returns the end time.
      • getElapsedTime

        public long getElapsedTime()
        Returns the elapsed time.
      • getSystemTime

        protected long getSystemTime()
        Returns the system time.
      • start

        public SPRunner<T> start()
        Starts the runner.
      • cancel

        public void cancel()
        Cancels the runner.
      • run

        public abstract T run()
                       throws java.lang.Exception
        The method to run.
        Throws:
        java.lang.Exception
      • success

        public void success​(T aResult)
        The method run on success.
      • cancelled

        public void cancelled​(java.lang.Exception e)
        The method to run when cancelled.
      • failure

        public void failure​(java.lang.Exception e)
        The method to run on failure.
      • finished

        public void finished()
        The method to run when finished (after success()/failure() call).
      • getResult

        public T getResult()
        Returns the result.
      • getExeption

        public java.lang.Throwable getExeption()
        Returns the exception.
      • invokeRun

        protected void invokeRun()
        Runs the run method.
      • invokeFinished

        protected void invokeFinished()
        Runs the success method.