Overview
JavaTaskBase provides a way to run Java application code on a thread other than the JavaFX event dispatch thread.
The Java application code is supplied to JavaTaskBase by the implementation of an abstract function create(), which returns an object supporting a Java interface RunnableFuture.
Profile: common
Inherited Variables
javafx.async.Task
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|---|---|---|---|---|---|---|
public-read protected | causeOfFailure | Object | subclass | subclass | null |
Indicates the cause of failure of this task. Indicates the cause of failure of this task. If this variable's value
is
See Also:
Profile: common |
|
public-read protected | done | Boolean | subclass | subclass | false |
Indicates if this task has completed. Indicates if this task has completed. This is the last of the
variables started, stopped, failed,
succeeded and causeOfFailure to be modified.
This variable is to be set to Profile: common |
|
public-read protected | failed | Boolean | subclass | subclass | false |
Indicates if this task has failed. Indicates if this task has failed.
This variable is set to
See Also:
Profile: common |
|
public-read protected | maxProgress | Long | subclass | subclass | -1 |
Indicates a maximum value for the progress variable. Indicates a maximum value for the progress variable. If set to zero or a negative value, there is no known maximum and the percentDone variable will not change during the course of execution of this task. -1
See Also:
Profile: common |
|
public | onDone | function():Void | null |
Callback that is invoked once to indicate that the task execution has completed (successfully, or unsuccessfully). Callback that is invoked once to indicate that the task execution has completed (successfully, or unsuccessfully). This task's implemenation will not modify this task's variables during or after a call to this function. Once the start() function has been called, this function will eventually be called, if it is non-null. null
See Also:
Profile: common |
|||
public | onStart | function():Void | null |
Callback that is invoked once to indicate that the task is about to start execution. |
|||
public-read | percentDone | Number | -1 |
Indicates the current progress of this task in terms of percent complete. Indicates the current progress of this task in terms of percent complete. A value between zero and one indicates progress toward completion. This variable's value may or may not change from its default value depending on the specific Task implementation. -1
See Also:
Profile: common |
|||
public-read protected | progress | Long | subclass | subclass | -1 |
Indicates the current progress toward completion of this task. Indicates the current progress toward completion of this task. Zero or a positive value indicate progress toward completion. This variable's value may or may not change from its default value depending on the specific Task implementation. -1
See Also:
Profile: common |
|
public-read protected | started | Boolean | subclass | subclass | false |
Indicates if this task has started. |
|
public-read protected | stopped | Boolean | subclass | subclass | false |
Indicates if this task has been stopped. Indicates if this task has been stopped.
This variable is set to
See Also:
Profile: common |
|
public-read protected | succeeded | Boolean | subclass | subclass | false |
Indicates if this task has successfully completed. |
Function Summary
- protected abstract create() : RunnableFuture
-
Create a RunnableFuture to be run on a thread other than the JavaFX dispatch thread.
Create a RunnableFuture to be run on a thread other than the JavaFX dispatch thread.
The RunnableFuture object returned cannot be a JavaFX object ornull
or the start() function will throw a java.lang.IllegalArgumentException. See stop() for constraints on the returned RunnableFuture with respect to being able to stop this task.See Also:
RunnableFuture, start(), stop()-
Returns
- RunnableFuture
Profile: common
- public start() : Void
-
Initiates execution of this task or queues this task for execution.
Initiates execution of this task or queues this task for execution.
This function will throw java.lang.IllegalArgumentException if the create() function returnsnull
, an object that does not support the RunnableFuture interface, or a JavaFX object.See Also:
Task#start(), create()Profile: common
- public stop() : Void
-
Terminates execution of this task.
Terminates execution of this task.
In order to allow this function to stop an executing task, any code called from the run() method of the RunnableFuture returned by create() must abide by the rules of Thread.interrupt() with respect to its executing thread receiving a java.lang.InterruptedException. Failure to make the RunnableFuture.run() method interruptible could lead to unstoppable JavaTaskBases that take up CPU and memory resources. Some relatively short JavaTaskBases, expected to last a maximum of serveral seconds, may not need to be interruptible.See Also:
RunnableFuture, Task.stop(), java.lang.Thread.interrupt()Profile: common
Inherited Functions
javafx.async.Task
- public abstract start() : Void
-
Initiates execution of this task.
Initiates execution of this task. Calling this function will either queue this task for future execution or start execution. The execution of the task happens on a thread other than the JavaFX event dispatch thread. The onStart function may not be called before this function returns. This function is expected to be called a maximum of once per instance of Task.
See Also:
onStartProfile: common
- public abstract stop() : Void
-
Terminates execution of this task.
Terminates execution of this task. Calling this function will either remove this task from the execution queue or stop execution. Subsequent calls to this function have no effect. The onDone function will be called as a result of calling this function, if it is non-null. The onDone function may not be called before this function returns. This function is expected to be called a maximum of once per instance of Task.
Profile: common