Class SPRunner<T>
java.lang.Object
com.inductiveautomation.rm.base.RMListenerList
com.inductiveautomation.rm.base.RMObject
com.inductiveautomation.snap.util.SPRunner<T>
- All Implemented Interfaces:
RMPropertyChanger
,Cloneable
- Direct Known Subclasses:
SwingRunner
A class for running operations in the background.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels the runner.void
The method to run when cancelled.void
The method to run on failure.void
finished()
The method to run when finished (after success()/failure() call).Returns a description of the current activity beging performed.long
Returns the elapsed time.long
Returns the end time.Returns the exception.getName()
Returns the name of runner (and thread).double
Returns the progress value.Returns the result.long
Returns the start time.Returns the status.protected long
Returns the system time.Returns the thread.protected void
Runs the success method.protected void
Runs the run method.boolean
isActive()
Returns whether thread is still active.boolean
Whether runner has been cancelled.join()
Joins the runner.join
(int aTimeout) Joins the runner.abstract T
run()
The method to run.void
setActivityText
(String aString) Sets a description of the current activity beging performed.void
Sets the name of runner (and thread).void
setProgress
(double aValue) Sets the progress value.protected void
setStatus
(SPRunner.Status aStatus) Sets the status.start()
Starts the runner.void
The method run on success.Methods inherited from class com.inductiveautomation.rm.base.RMObject
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange, toString
Methods inherited from class com.inductiveautomation.rm.base.RMListenerList
addListener, clone, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
-
Field Details
-
Progress_Prop
- See Also:
-
ActivityText_Prop
- See Also:
-
Status_Prop
- See Also:
-
-
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
Returns the name of runner (and thread). -
setName
Sets the name of runner (and thread). -
getActivityText
Returns a description of the current activity beging performed. -
setActivityText
Sets a description of the current activity beging performed. -
getStatus
Returns the status. -
setStatus
Sets the status. -
getThread
Returns the thread. -
join
Joins the runner. -
join
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
Starts the runner. -
cancel
public void cancel()Cancels the runner. -
run
The method to run.- Throws:
Exception
-
success
The method run on success. -
cancelled
The method to run when cancelled. -
failure
The method to run on failure. -
finished
public void finished()The method to run when finished (after success()/failure() call). -
getResult
Returns the result. -
getExeption
Returns the exception. -
invokeRun
protected void invokeRun()Runs the run method. -
invokeFinished
protected void invokeFinished()Runs the success method.
-