- All Implemented Interfaces:
Serializable
,Comparable<Worker.State>
,Constable
The state of a Worker. The state transitions in a Worker are very well defined. All Workers begin in the READY state. In some circumstances, a Worker might be scheduled for execution before it is actually executed. In such cases, it is sometimes useful to know when the Worker has been SCHEDULED separately from when it is RUNNING. However even in cases where the Worker is executed immediately, the Worker will temporarily enter the SCHEDULED state before entering the RUNNING state. That is, the transition is always from READY to SCHEDULED to RUNNING (unless of course the Worker in cancelled).
A Worker which runs but is never cancelled can only end up in one of two states, either SUCCEEDED or FAILED. It only enters FAILED if an exception was thrown during the execution of the Worker. A Worker may be cancelled when READY, SCHEDULED, or RUNNING, in which case the final status will be CANCELLED. When a Worker is cancelled in one of these circumstances it will transition immediately to the CANCELLED state.
A reusable Worker will transition from CANCELLED, SUCCEEDED or FAILED back to READY. From that point the normal state transitions are again followed.
- Since:
- JavaFX 2.0
-
Nested Class Summary
Nested classes/interfaces declared in class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionIndicates that this Worker has been cancelled via theWorker.cancel()
method.Indicates that this Worker has failed, usually due to some unexpected condition having occurred.Indicates that the Worker has not yet been executed and is ready to be executed, or that it has been reinitialized.Indicates that this Worker is running.Indicates that the Worker has been scheduled for execution, but that it is not currently running.Indicates that this Worker has completed successfully, and that there is a valid result ready to be read from thevalue
property. -
Method Summary
Modifier and TypeMethodDescriptionstatic Worker.State
Returns the enum constant of this class with the specified name.static Worker.State[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
READY
Indicates that the Worker has not yet been executed and is ready to be executed, or that it has been reinitialized. This is the default initial state of the Worker. -
SCHEDULED
Indicates that the Worker has been scheduled for execution, but that it is not currently running. This might be because the Worker is waiting for a thread in a thread pool to become available before it can start running. -
RUNNING
Indicates that this Worker is running. This is set just immediately prior to the Worker actually doing its first bit of work. -
SUCCEEDED
Indicates that this Worker has completed successfully, and that there is a valid result ready to be read from thevalue
property. -
CANCELLED
Indicates that this Worker has been cancelled via theWorker.cancel()
method. -
FAILED
Indicates that this Worker has failed, usually due to some unexpected condition having occurred. The exception can be retrieved from theexception
property.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-