Class SPRunner<T>

All Implemented Interfaces:
RMPropertyChanger, Cloneable
Direct Known Subclasses:
SwingRunner

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

  • Constructor Details

    • SPRunner

      public SPRunner()
  • Method Details

    • getProgress

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

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

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

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

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

      public void setActivityText(String aString)
      Sets a description of the current activity beging performed.
    • getStatus

      public SPRunner.Status getStatus()
      Returns the status.
    • setStatus

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

      public 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 Exception
      The method to run.
      Throws:
      Exception
    • success

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

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

      public void failure(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 Throwable getExeption()
      Returns the exception.
    • invokeRun

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

      protected void invokeFinished()
      Runs the success method.