T
- Return type of the Callable
.public class SynchronousJFXCaller<T> extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.Callable<T> |
callable |
Constructor and Description |
---|
SynchronousJFXCaller(java.util.concurrent.Callable<T> callable)
Constructs a new caller that will execute the provided callable.
|
Modifier and Type | Method and Description |
---|---|
T |
call(long startTimeout,
java.util.concurrent.TimeUnit startTimeoutUnit)
Executes the Callable.
|
public SynchronousJFXCaller(java.util.concurrent.Callable<T> callable)
callable
- Action to execute on the JFX event thread.public T call(long startTimeout, java.util.concurrent.TimeUnit startTimeoutUnit) throws java.lang.Exception
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.
startTimeout
- time to wait for Platform.runLater() to start
the dialog-showing taskstartTimeoutUnit
- the time unit of the startTimeout argumentjava.lang.IllegalStateException
- if Platform.runLater() fails to start
the task within the given timeoutjava.lang.InterruptedException
- 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)java.lang.Exception