The method that does the asynchronous work.
The method that does the asynchronous work.
Waits for the run() method to complete.
Waits for the run() method to start.
Checks to see if an exception has been raised by an asynchronous thread and if so rethrows it.
Checks to see if an exception has been raised by an asynchronous thread and if so rethrows it. Use this method before code that assumes the threads have not encountered an exception.
Returns true if the run() method has completed, false otherwise.
The name of this runnable.
The name of this runnable. This is used as the name of the thread in thread() as well. The name is created based on the class name and the number of AsyncRunnables already created.
Starts this Runnable in a daemon thread.
Starts this Runnable in a daemon thread.
optionally the name of the thread, otherwise a name is created based on the class name and the number of threads already created.
Returns true if the run() method has started, false otherwise.
Creates a new thread wrapping this runnable; the thread is not started.
Returns a throwable if an exception occurred in the run() method, None otherwise.
Executes the given block of code.
Executes the given block of code. If an InterruptedException is thrown, throws a RuntimeException with the given message. Use this method for blocking code that when interrupted should not be recoverable.
the message to use if an InterruptedException is thrown by the block of code
the block of code to execute
Returns an Awaitable that completes when the run() method has completed.
Returns an Awaitable that completes when the run() method has completed. Returns the throwable if an exception was encountered, None otherwise.
The method to execute if an exception occurs in the asynchronous thread.
The method to execute if an exception occurs in the asynchronous thread. This should not block.
The method to execute upon successfully execution of the run method or an exception occurs.
The method to execute upon successfully execution of the run method or an exception occurs. This should not block.
Returns an Awaitable that completes when the run() method has started.
Returns an Awaitable that completes when the run() method has started. Returns the throwable if an exception was encountered, None otherwise.
A trait that can be mixed in to help manage asynchronous execution while being Runnable.
The
execute()
method should contain the work to be performed asynchronously.The
thread()
method can be used to return a Thread that wraps this Runnable.The
start()
method can be used to create and start daemon Thread that wraps this Runnable.The
checkAndRaise()
method should be used by implementing classes to check if theexecute()
method has encountered an exception, and if so, it will rethrow the exception as an Error or RuntimeException.The
tryAndModifyInterruptedException()
method should wrap blocking code in implementing classes that are not part of theexecute()
method. This method will throw a RuntimeException if interrupted while waiting.