Class SynchronousJFXCaller<T>
java.lang.Object
edu.wisc.ssec.mcidasv.util.nativepathchooser.SynchronousJFXCaller<T>
- Type Parameters:
T
- Return type of theCallable
.
A utility class to execute a Callable synchronously
on the JavaFX event thread.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSynchronousJFXCaller
(Callable<T> callable) Constructs a new caller that will execute the provided callable. -
Method Summary
-
Field Details
-
callable
-
-
Constructor Details
-
SynchronousJFXCaller
Constructs a new caller that will execute the provided callable. The callable is accessed from the JavaFX event thread, so it should either be immutable or at least its state shouldn't be changed randomly while the call() method is in progress.- Parameters:
callable
- Action to execute on the JFX event thread.
-
-
Method Details
-
call
Executes the Callable.A specialized task is run using Platform.runLater(). The calling thread then waits first for the task to start, then for it to return a result. Any exception thrown by the Callable will be rethrown in the calling thread.
- Parameters:
startTimeout
- time to wait for Platform.runLater() to start the dialog-showing taskstartTimeoutUnit
- the time unit of the startTimeout argument- Returns:
- whatever the Callable returns
- Throws:
IllegalStateException
- if Platform.runLater() fails to start the task within the given timeoutInterruptedException
- if the calling (this) thread is interrupted while waiting for the task to start or to get its result (note that the task will still run anyway and its result will be ignored)Exception
-