Spec-Zone.ru › OpenJavaFX 17

Enum Worker.State

java.lang.Object
java.lang.Enum<Worker.State>
javafx.concurrent.Worker.State
All Implemented Interfaces:
Serializable, Comparable<Worker.State>, Constable
Enclosing interface:
Worker<V>
public static enum Worker.State
extends Enum<Worker.State>

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 Constants
Enum Constant Description
CANCELLED
Indicates that this Worker has been cancelled via the Worker.cancel() method.
FAILED
Indicates that this Worker has failed, usually due to some unexpected condition having occurred.
READY
Indicates that the Worker has not yet been executed and is ready to be executed, or that it has been reinitialized.
RUNNING
Indicates that this Worker is running.
SCHEDULED
Indicates that the Worker has been scheduled for execution, but that it is not currently running.
SUCCEEDED
Indicates that this Worker has completed successfully, and that there is a valid result ready to be read from the value property.

Method Summary

Modifier and Type Method Description
static Worker.State valueOf​(String name)
Returns the enum constant of this type with the specified name.
static Worker.State[] values()
Returns an array containing the constants of this enum type, in the order they are declared.

Methods declared in class java.lang.Enum

clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

Methods declared in class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Enum Constant Details

READY

public static final Worker.State 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

public static final Worker.State 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

public static final Worker.State RUNNING
Indicates that this Worker is running. This is set just immediately prior to the Worker actually doing its first bit of work.

SUCCEEDED

public static final Worker.State SUCCEEDED
Indicates that this Worker has completed successfully, and that there is a valid result ready to be read from the value property.

CANCELLED

public static final Worker.State CANCELLED
Indicates that this Worker has been cancelled via the Worker.cancel() method.

FAILED

public static final Worker.State FAILED
Indicates that this Worker has failed, usually due to some unexpected condition having occurred. The exception can be retrieved from the exception property.

Method Details

values

public static Worker.State[] values()
Returns an array containing the constants of this enum type, in the order they are declared.
Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Worker.State valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
NullPointerException - if the argument is null

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API