public abstract class BaseWatchable extends java.lang.Object implements Watchable, java.lang.Runnable
COMPLETED, ERROR, NEEDS_DATA, NOT_STARTED, PAUSED, RUNNING, STOPPED, UNKNOWN
Modifier | Constructor and Description |
---|---|
protected |
BaseWatchable()
Creates a new instance of BaseWatchable
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanup()
Clean up after a set of iterations.
|
protected void |
execute(boolean synchronous)
Start executing this watchable
|
int |
getStatus()
Get the status of this watchable
|
void |
go()
Start this watchable and run in a new thread until it is finished or
stopped.
|
void |
go(boolean synchronous)
Start this watchable and run until it is finished or stopped.
|
void |
go(int steps)
Start this watchable and run for the given number of steps or until
finished or stopped.
|
void |
go(long millis)
Start this watchable and run for the given amount of time, or until
finished or stopped.
|
boolean |
isExecutable()
return true if this watchable is ready to be executed
|
boolean |
isFinished()
Return whether this watchable has finished.
|
static boolean |
isSuppressSetErrorStackTrace()
return true if we would be suppressing setError stack traces.
|
protected abstract int |
iterate()
Perform a single iteration of this watchable.
|
void |
run() |
protected void |
setError(java.lang.Exception error)
Set an error on this watchable
|
protected void |
setStatus(int status)
Set the status of this watchable
|
static void |
setSuppressSetErrorStackTrace(boolean suppressTrace)
set suppression of stack traces from setError.
|
protected void |
setup()
Prepare for a set of iterations.
|
void |
stop()
Stop this watchable.
|
void |
waitForFinish()
Wait for this watchable to finish
|
protected abstract int iterate() throws java.lang.Exception
java.lang.Exception
protected void setup()
protected void cleanup()
public void run()
run
in interface java.lang.Runnable
public int getStatus()
public boolean isFinished()
public boolean isExecutable()
public void stop()
public void go()
public void go(boolean synchronous)
synchronous
- if true, run in this threadpublic void go(int steps)
public void go(long millis)
public void waitForFinish()
protected void execute(boolean synchronous)
synchronous
- if true, run in this threadprotected void setStatus(int status)
public static boolean isSuppressSetErrorStackTrace()
public static void setSuppressSetErrorStackTrace(boolean suppressTrace)
suppressTrace
- protected void setError(java.lang.Exception error)