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.
Enum Constant and 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. |
Modifier and Type | Method and 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.
|
public static final Worker.State READY
public static final Worker.State SCHEDULED
public static final Worker.State RUNNING
public static final Worker.State SUCCEEDED
value
property.public static final Worker.State CANCELLED
Worker.cancel()
method.public static final Worker.State FAILED
exception
property.public static Worker.State[] values()
for (Worker.State c : Worker.State.values()) System.out.println(c);
public static Worker.State valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullSubmit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.