Package org.testfx.util
Class WaitForAsyncUtils.ASyncFXCallable<X>
java.lang.Object
java.util.concurrent.FutureTask<X>
org.testfx.util.WaitForAsyncUtils.ASyncFXCallable<X>
- Type Parameters:
X
- the return type of the callable
- All Implemented Interfaces:
Runnable
,Callable<X>
,Future<X>
,RunnableFuture<X>
- Enclosing class:
WaitForAsyncUtils
private static class WaitForAsyncUtils.ASyncFXCallable<X>
extends FutureTask<X>
implements Callable<X>
Internally used
Callable
that handles all the async stuff. All external
Callables/Runnables must be wrapped in this class.
Note: This is a single call object. Do not use twice!
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Throwable
The unhandled exception.private final boolean
If true, exceptions will be added to the internal stack.private final StackTraceElement[]
Holds the stacktrace of the caller, for printing, if an Exception occurs. -
Constructor Summary
ConstructorsConstructorDescriptionASyncFXCallable
(Runnable runnable, boolean throwException) ASyncFXCallable
(Callable<X> callable, boolean throwException) -
Method Summary
Methods inherited from class java.util.concurrent.FutureTask
cancel, done, exceptionNow, isCancelled, isDone, resultNow, run, runAndReset, set, state, toString
-
Field Details
-
throwException
private final boolean throwExceptionIf true, exceptions will be added to the internal stack. -
trace
Holds the stacktrace of the caller, for printing, if an Exception occurs. -
exception
The unhandled exception.
-
-
Constructor Details
-
ASyncFXCallable
-
ASyncFXCallable
-
-
Method Details
-
setException
Called to handle exceptions during run().- Overrides:
setException
in classFutureTask<X>
-
transformException
Transforms am exception to be a throwable. Basically wraps the exception in a RuntimeException, if it is not already one.- Parameters:
exception
- the exception to transform- Returns:
- the throwable exception
-
call
-
get
- Specified by:
get
in interfaceFuture<X>
- Overrides:
get
in classFutureTask<X>
- Throws:
InterruptedException
ExecutionException
-
get
public X get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
get
in interfaceFuture<X>
- Overrides:
get
in classFutureTask<X>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-