Class EasyThread
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback listener for errors on easy thread -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a callback for error events, notice that this code isn't thread safe and should be invoked synchronously.static voidAdds a callback for error events, notice that this code isn't thread safe and should be invoked synchronously.booleanisThisIt()Returns true if the current thread is the easy thread and false othewise similar to the isEDT methodvoidkill()Stops the thread once the current task completesvoidRemoves a callback for error events, notice that this code isn't thread safe and should be invoked synchronously.static voidRemoves a callback for error events, notice that this code isn't thread safe and should be invoked synchronously.<T> voidrun(RunnableWithResult<T> r, SuccessCallback<T> t) Runs the given object asynchronously on the thread and returns the result object<T> Trun(RunnableWithResultSync<T> r) Runs the given runnable on the thread and blocks until it completes, returns the value objectvoidRuns the given runnable on the thread, the method returns immediatelyvoidInvokes the given runnable on the thread and waits for its execution to completevoidsetPriority(int newPriority) Changes the priority of this EasyThread.static EasyThreadStarts a new thread
-
Method Details
-
start
Starts a new thread
Parameters
name: the display name for the thread
Returns
a new thread instance
-
addGlobalErrorListener
Adds a callback for error events, notice that this code isn't thread safe and should be invoked synchronously. This method must never be invoked from within the resulting callback code!
Parameters
err: the error callback
-
removeGlobalErrorListener
Removes a callback for error events, notice that this code isn't thread safe and should be invoked synchronously. This method must never be invoked from within the resulting callback code!
Parameters
err: the error callback
-
run
Runs the given object asynchronously on the thread and returns the result object
Parameters
-
r: runs this method -
t: object is passed to the success callback
-
-
run
Runs the given runnable on the thread, the method returns immediately
Parameters
r: the runnable
-
run
Runs the given runnable on the thread and blocks until it completes, returns the value object
Parameters
r: the runnable with result that will execute on the thread
Returns
value returned by r
-
runAndWait
Invokes the given runnable on the thread and waits for its execution to complete
Parameters
r: the runnable
-
kill
public void kill()Stops the thread once the current task completes -
isThisIt
public boolean isThisIt()Returns true if the current thread is the easy thread and false othewise similar to the isEDT method
Returns
true if we are currently within this easy thread
-
addErrorListener
Adds a callback for error events, notice that this code isn't thread safe and should be invoked synchronously. This method must never be invoked from within the resulting callback code!
Parameters
err: the error callback
-
removeErrorListener
Removes a callback for error events, notice that this code isn't thread safe and should be invoked synchronously. This method must never be invoked from within the resulting callback code!
Parameters
err: the error callback
-
setPriority
public void setPriority(int newPriority) Changes the priority of this EasyThread.
Parameters
newPriority: priority to set this thread to
-