A Service is a non-visual component encapsulating the information required
to perform some work on one or more background threads. As part of the
JavaFX UI library, the Service knows about the JavaFX Application thread
and is designed to relieve the application developer from the burden
of managing multithreaded code that interacts with the user interface. As
such, all of the methods and state on the Service are intended to be
invoked exclusively from the JavaFX Application thread. The only exception
to this is when initially configuring a Service, which may safely be done
from any thread, and initially starting a Service, which may also safely
be done from any thread. However, once the Service has been initialized and
started, it may only thereafter be used from the FX thread.
A Service creates and manages a Task that performs the work
on the background thread.
Service implements Worker. As such, you can observe the state of
the background task and optionally cancel it. Service is a reusable
Worker, meaning that it can be reset and restarted. Due to this, a Service
can be constructed declaratively and restarted on demand.
Once a Service is started, it will schedule its Task and listen for
changes to the state of the Task. A Task does not hold a reference to the
Service that started it, meaning that a running Task will not prevent
the Service from being garbage collected.
If an java. is specified on the Service,
then it will be used to actually execute the service. Otherwise,
a daemon thread will be created and executed. If you wish to create
non-daemon threads, then specify a custom Executor (for example,
you could use a ThreadPoolExecutor with a custom
java.).
Because a Service is intended to simplify declarative use cases, subclasses
should expose as properties the input parameters to the work to be done.
For example, to write a Service that reads the first line
from any URL and returns it as a String, it might be defined with
a single property, url, and might be implemented as:
public static class FirstLineService extends Service<String> {
private StringProperty url = new SimpleStringProperty(this, "url");
public final void setUrl(String value) { url.set(value); }
public final String getUrl() { return url.get(); }
public final StringProperty urlProperty() { return url; }
protected Task createTask() {
final String _url = getUrl();
return new Task<String>() {
protected String call() throws Exception {
URL u = new URL(_url);
BufferedReader in = new BufferedReader(
new InputStreamReader(u.openStream()));
String result = in.readLine();
in.close();
return result;
}
};
}
}
The Service by default uses a ThreadPoolExecutor with some unspecified
default or maximum thread pool size. This is done so that naive code
will not completely swamp the system by creating thousands of Threads.
| Modifier and Type | Field and Description |
|---|---|
| private EventHelper | |
| private final ObjectProperty | |
| private static final ThreadPoolExecutor | |
| private final ObjectProperty | executor
The executor to use for running this Service. |
| private static final BlockingQueue | IO_QUEUE
Because the ThreadPoolExecutor works completely backwards from what we want (ie: it doesn't increase thread count beyond the core pool size unless the queue is full), our queue has to be smart in that it will REJECT an item in the queue unless the thread size in the EXECUTOR is > 32, in which case we will queue up. |
| private static final PlatformLogger | LOG
Logger used in the case of some uncaught exceptions |
| private final StringProperty | |
| private final DoubleProperty | |
| private final BooleanProperty | |
| private volatile boolean | startedOnce
This boolean is set to true once the Service has been initially started. |
| private final ObjectProperty | |
| private Task | task
A reference to the last task that was executed. |
| private static final ThreadFactory | |
| private static final ThreadGroup | |
| private static final int | |
| private static final long | |
| private final StringProperty | |
| private final DoubleProperty | |
| private static final Thread. | |
| private final ObjectProperty | |
| private final DoubleProperty |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public final <T extends Event> void | addEventFilter(final EventType<T>
the type of the events received by the filter eventType, final EventHandler<? super T> the event filter eventFilter)Overrides default javafx. Registers an event filter for this target. |
| public final <T extends Event> void | addEventHandler(final EventType<T>
the type of the events received by the handler eventType, final EventHandler<? super T> the event handler eventHandler)Overrides default javafx. Registers an event handler for this target. |
| public EventDispatchChain | buildEventDispatchChain(EventDispatchChain
the initial chain to build from tail)Implements javafx. Construct an event dispatch chain for this target. |
| public boolean | Returns: returns true if the cancel was successfulImplements javafx. Cancels any currently running Task, if any. |
| pack-priv void | cancelFromReadyState()
This is used by ScheduledService to cancel a Service that is in the READY state. |
| protected void | cancelled()
A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the CANCELLED state. |
| pack-priv void | |
| protected abstract Task | Returns: the Task to executeInvoked after the Service is started on the JavaFX Application Thread. |
| public final ReadOnlyObjectProperty | exceptionProperty()
Implements javafx. Gets the ReadOnlyObjectProperty representing any exception which occurred. |
| protected void | executeTask(final Task<V>
a non-null task to execute task)
Uses the |
| public final ObjectProperty | |
| protected void | failed()
A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the FAILED state. |
| protected final void | |
| private EventHelper | |
| public final Throwable | getException()
Implements javafx. Indicates the exception which occurred while the Worker was running, if any. |
| public final Executor | |
| public final String | getMessage()
Implements javafx. Gets a message associated with the current state of this Worker. |
| public final EventHandler | Returns: the onCancelled event handler, if anyThe onCancelled event handler is called whenever the Task state transitions to the CANCELLED state. |
| public final EventHandler | Returns: the onFailed event handler, if anyThe onFailed event handler is called whenever the Task state transitions to the FAILED state. |
| public final EventHandler | Returns: the onReady event handler, if anyThe onReady event handler is called whenever the Task state transitions to the READY state. |
| public final EventHandler | Returns: the onRunning event handler, if anyThe onRunning event handler is called whenever the Task state transitions to the RUNNING state. |
| public final EventHandler | Returns: the onScheduled event handler, if anyThe onSchedule event handler is called whenever the Task state transitions to the SCHEDULED state. |
| public final EventHandler | Returns: the onSucceeded event handler, if anyThe onSucceeded event handler is called whenever the Task state transitions to the SUCCEEDED state. |
| public final double | getProgress()
Implements javafx. Indicates the current progress of this Worker in terms of percent complete. |
| public final Worker. | |
| public final String | getTitle()
Implements javafx. An optional title that should be associated with this Worker. |
| public final double | getTotalWork()
Implements javafx. Indicates a maximum value for the |
| public final V | getValue()
Implements javafx. Specifies the value, or result, of this Worker. |
| public final double | getWorkDone()
Implements javafx. Indicates the current amount of work that has been completed. |
| pack-priv boolean | |
| public final boolean | isRunning()
Implements javafx. True if the state is either SCHEDULED or RUNNING. |
| public final ReadOnlyStringProperty | messageProperty()
Implements javafx. Gets the ReadOnlyStringProperty representing the message. |
| public final ObjectProperty | Returns: the onCancelled event handler propertyThe onCancelled event handler is called whenever the Task state transitions to the CANCELLED state. |
| public final ObjectProperty | Returns: the onFailed event handler propertyThe onFailed event handler is called whenever the Task state transitions to the FAILED state. |
| public final ObjectProperty | Returns: the onReady event handler propertyThe onReady event handler is called whenever the Task state transitions to the READY state. |
| public final ObjectProperty | Returns: the onRunning event handler propertyThe onRunning event handler is called whenever the Task state transitions to the RUNNING state. |
| public final ObjectProperty | Returns: the onScheduled event handler propertyThe onSchedule event handler is called whenever the Task state transitions to the SCHEDULED state. |
| public final ObjectProperty | Returns: the onSucceeded event handler propertyThe onSucceeded event handler is called whenever the Task state transitions to the SUCCEEDED state. |
| public final ReadOnlyDoubleProperty | progressProperty()
Implements javafx. Gets the ReadOnlyDoubleProperty representing the progress. |
| protected void | ready()
A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the READY state. |
| public final <T extends Event> void | removeEventFilter(final EventType<T>
the event type from which to unregister eventType, final EventHandler<? super T> the event filter eventFilter)Overrides default javafx. Unregisters a previously registered event filter from this target. |
| public final <T extends Event> void | removeEventHandler(final EventType<T>
the event type from which to unregister eventType, final EventHandler<? super T> the event handler eventHandler)Overrides default javafx. Unregisters a previously registered event handler from this target. |
| public void | |
| public void | |
| pack-priv void | |
| protected void | running()
A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the RUNNING state. |
| public final ReadOnlyBooleanProperty | runningProperty()
Implements javafx. Gets the ReadOnlyBooleanProperty representing whether the Worker is running. |
| protected void | scheduled()
A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the SCHEDULED state. |
| protected final < the specific event class of the handler T extends Event> void | setEventHandler(final EventType<T>
the event type to associate with the given eventHandler eventType, final EventHandler<? super T> the handler to register, or null to unregister eventHandler)Sets the handler to use for this event type. |
| public final void | |
| public final void | setOnCancelled(EventHandler<WorkerStateEvent>
the event handler, can be null to clear it value)The onCancelled event handler is called whenever the Task state transitions to the CANCELLED state. |
| public final void | setOnFailed(EventHandler<WorkerStateEvent>
the event handler, can be null to clear it value)The onFailed event handler is called whenever the Task state transitions to the FAILED state. |
| public final void | setOnReady(EventHandler<WorkerStateEvent>
the event handler, can be null to clear it value)The onReady event handler is called whenever the Task state transitions to the READY state. |
| public final void | setOnRunning(EventHandler<WorkerStateEvent>
the event handler, can be null to clear it value)The onRunning event handler is called whenever the Task state transitions to the RUNNING state. |
| public final void | setOnScheduled(EventHandler<WorkerStateEvent>
the event handler, can be null to clear it value)The onSchedule event handler is called whenever the Task state transitions to the SCHEDULED state. |
| public final void | setOnSucceeded(EventHandler<WorkerStateEvent>
the event handler, can be null to clear it value)The onSucceeded event handler is called whenever the Task state transitions to the SUCCEEDED state. |
| public void | |
| public final ReadOnlyObjectProperty | stateProperty()
Implements javafx. Gets the ReadOnlyObjectProperty representing the current state. |
| protected void | succeeded()
A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the SUCCEEDED state. |
| public final ReadOnlyStringProperty | titleProperty()
Implements javafx. Gets the ReadOnlyStringProperty representing the title. |
| public final ReadOnlyDoubleProperty | totalWorkProperty()
Implements javafx. Gets the ReadOnlyDoubleProperty representing the maximum amount of work that needs to be done. |
| public final ReadOnlyObjectProperty | valueProperty()
Implements javafx. Gets the ReadOnlyObjectProperty representing the value. |
| public final ReadOnlyDoubleProperty | workDoneProperty()
Implements javafx. Gets the ReadOnlyDoubleProperty representing the current progress. |
| eventHelper | back to summary |
|---|---|
| private EventHelper eventHelper | |
| exception | back to summary |
|---|---|
| private final ObjectProperty<Throwable> exception | |
| EXECUTOR | back to summary |
|---|---|
| private static final ThreadPoolExecutor EXECUTOR | |
| executor | back to summary |
|---|---|
| private final ObjectProperty<Executor> executor The executor to use for running this Service. If no executor is specified, then a new daemon thread will be created and used for running the Service using some default executor. | |
| IO_QUEUE | back to summary |
|---|---|
| private static final BlockingQueue<Runnable> IO_QUEUE Because the ThreadPoolExecutor works completely backwards from what we want (ie: it doesn't increase thread count beyond the core pool size unless the queue is full), our queue has to be smart in that it will REJECT an item in the queue unless the thread size in the EXECUTOR is > 32, in which case we will queue up. | |
| LOG | back to summary |
|---|---|
| private static final PlatformLogger LOG Logger used in the case of some uncaught exceptions | |
| message | back to summary |
|---|---|
| private final StringProperty message | |
| progress | back to summary |
|---|---|
| private final DoubleProperty progress | |
| running | back to summary |
|---|---|
| private final BooleanProperty running | |
| startedOnce | back to summary |
|---|---|
| private volatile boolean startedOnce This boolean is set to true once the Service has been initially started. You can initialize the Service from any thread, and you can initially start it from any thread. But any subsequent usage of the service's methods must occur on the FX application thread. | |
| state | back to summary |
|---|---|
| private final ObjectProperty<Worker. | |
| task | back to summary |
|---|---|
| private Task<V> task A reference to the last task that was executed. I need this reference so that in the restart method I can cancel the currently running task, and so the cancel method can cancel the currently running task. | |
| THREAD_FACTORY | back to summary |
|---|---|
| private static final ThreadFactory THREAD_FACTORY | |
| THREAD_GROUP | back to summary |
|---|---|
| private static final ThreadGroup THREAD_GROUP | |
| THREAD_POOL_SIZE | back to summary |
|---|---|
| private static final int THREAD_POOL_SIZE | |
| THREAD_TIME_OUT | back to summary |
|---|---|
| private static final long THREAD_TIME_OUT | |
| title | back to summary |
|---|---|
| private final StringProperty title | |
| totalWorkToBeDone | back to summary |
|---|---|
| private final DoubleProperty totalWorkToBeDone | |
| UNCAUGHT_HANDLER | back to summary |
|---|---|
| private static final Thread. | |
| value | back to summary |
|---|---|
| private final ObjectProperty<V> value | |
| workDone | back to summary |
|---|---|
| private final DoubleProperty workDone | |
| Service | back to summary |
|---|---|
| protected Service() Create a new Service. | |
| addEventFilter | back to summary |
|---|---|
| public final <T extends Event> void addEventFilter(final EventType<T> eventType, final EventHandler<? super T> eventFilter) Overrides default javafx. Doc from javafx. Registers an event filter for this target.
The filter is called when the target receives an
| |
| addEventHandler | back to summary |
|---|---|
| public final <T extends Event> void addEventHandler(final EventType<T> eventType, final EventHandler<? super T> eventHandler) Overrides default javafx. Doc from javafx. Registers an event handler for this target.
The handler is called when the target receives an
| |
| buildEventDispatchChain | back to summary |
|---|---|
| public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail) Implements javafx. Doc from javafx. Construct an event dispatch chain for this target. The event dispatch
chain contains event dispatchers which might be interested in processing
of events targeted at this In the case the event target is part of some hierarchy, the chain for it is usually built from event dispatchers collected from the root of the hierarchy to the event target. The event dispatch chain is constructed by modifications to the provided initial event dispatch chain. The returned chain should have the initial chain at its end so the dispatchers should be prepended to the initial chain. The caller shouldn't assume that the initial chain remains unchanged nor that the returned value will reference a different chain.
| |
| cancel | back to summary |
|---|---|
| public boolean cancel() Implements javafx. Cancels any currently running Task, if any. The state will be set to CANCELLED.
| |
| cancelFromReadyState | back to summary |
|---|---|
| pack-priv void cancelFromReadyState() This is used by ScheduledService to cancel a Service that is in the READY state. The problem is that a ScheduledService will iterate from SUCCEEDED to READY, and then call start() to transition from READY to SCHEDULED and kick off a new iteration. However, if from the SUCCEEDED event handler a developer calls "cancel" to stop a ScheduledService, we have a problem, since the Service specification does not allow to transition from a terminal state (SUCCEEDED) to another terminal state (CANCELLED), but this is clearly what we need to do. So what this method will do is allow us to transition from the READY state to the CANCELLED state, by transitioning through SCHEDULED | |
| cancelled | back to summary |
|---|---|
| protected void cancelled() A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the CANCELLED state. This method is invoked after the Service has been fully transitioned to the new state.
| |
| checkThread | back to summary |
|---|---|
| pack-priv void checkThread() | |
| createTask | back to summary |
|---|---|
| protected abstract Task Invoked after the Service is started on the JavaFX Application Thread. Implementations should save off any state into final variables prior to creating the Task, since accessing properties defined on the Service within the background thread code of the Task will result in exceptions. For example:
If the Task is a pre-defined class (as opposed to being an anonymous class), and if it followed the recommended best-practice, then there is no need to save off state prior to constructing the Task since its state is completely provided in its constructor.
| |
| exceptionProperty | back to summary |
|---|---|
| public final ReadOnlyObjectProperty Implements javafx. Doc from javafx. Gets the ReadOnlyObjectProperty representing any exception which occurred.
| |
| executeTask | back to summary |
|---|---|
| protected void executeTask(final Task<V> task)
Uses the This method is intended only to be called by the Service implementation.
| |
| executorProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| failed | back to summary |
|---|---|
| protected void failed() A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the FAILED state. This method is invoked after the Service has been fully transitioned to the new state.
| |
| fireEvent | back to summary |
|---|---|
| protected final void fireEvent(Event event) Fires the specified event. Any event filter encountered will be notified and can consume the event. If not consumed by the filters, the event handlers on this task are notified. If these don't consume the event either, then all event handlers are called and can consume the event. This method must be called on the FX user thread.
| |
| getEventHelper | back to summary |
|---|---|
| private EventHelper getEventHelper() | |
| getException | back to summary |
|---|---|
| public final Throwable getException() Implements javafx. Doc from javafx. Indicates the exception which occurred while the Worker was running, if any.
If this property value is | |
| getExecutor | back to summary |
|---|---|
| public final Executor getExecutor() | |
| getMessage | back to summary |
|---|---|
| public final String getMessage() Implements javafx. Doc from javafx. Gets a message associated with the current state of this Worker. This may be something such as "Processing image 1 of 3", for example. | |
| getOnCancelled | back to summary |
|---|---|
| public final EventHandler The onCancelled event handler is called whenever the Task state transitions to the CANCELLED state.
| |
| getOnFailed | back to summary |
|---|---|
| public final EventHandler The onFailed event handler is called whenever the Task state transitions to the FAILED state.
| |
| getOnReady | back to summary |
|---|---|
| public final EventHandler The onReady event handler is called whenever the Task state transitions to the READY state.
| |
| getOnRunning | back to summary |
|---|---|
| public final EventHandler The onRunning event handler is called whenever the Task state transitions to the RUNNING state.
| |
| getOnScheduled | back to summary |
|---|---|
| public final EventHandler The onSchedule event handler is called whenever the Task state transitions to the SCHEDULED state.
| |
| getOnSucceeded | back to summary |
|---|---|
| public final EventHandler The onSucceeded event handler is called whenever the Task state transitions to the SUCCEEDED state.
| |
| getProgress | back to summary |
|---|---|
| public final double getProgress() Implements javafx. Doc from javafx. Indicates the current progress of this Worker in terms of percent complete. A value between zero and one indicates progress toward completion. A value of -1 means that the current progress cannot be determined (that is, it is indeterminate). This property may or may not change from its default value of -1 depending on the specific Worker implementation.
| |
| getState | back to summary |
|---|---|
| public final Worker. Implements javafx. Doc from javafx. Specifies the current state of this Worker. The initial value is State.READY. A Task may be restarted, in which case it will progress from one of these end states (SUCCEEDED, CANCELLED, or FAILED) back to READY and then immediately to SCHEDULED and RUNNING. These state transitions may occur immediately one after the other, but will always occur in the prescribed order. | |
| getTitle | back to summary |
|---|---|
| public final String getTitle() Implements javafx. Doc from javafx. An optional title that should be associated with this Worker. This may be something such as "Modifying Images". | |
| getTotalWork | back to summary |
|---|---|
| public final double getTotalWork() Implements javafx. Doc from javafx. Indicates a maximum value for the
| |
| getValue | back to summary |
|---|---|
| public final V getValue() Implements javafx. Doc from javafx. Specifies the value, or result, of this Worker. This is set upon entering the SUCCEEDED state, and cleared (set to null) if the Worker is reinitialized (that is, if the Worker is a reusable Worker and is reset or restarted).
| |
| getWorkDone | back to summary |
|---|---|
| public final double getWorkDone() Implements javafx. Doc from javafx. Indicates the current amount of work that has been completed. Zero or a positive value indicate progress toward completion. This variables value may or may not change from its default value depending on the specific Worker implementation. A value of -1 means that the current amount of work done cannot be determined (ie: it is indeterminate). The value of this property is always less than or equal to totalWork.
| |
| isFxApplicationThread | back to summary |
|---|---|
| pack-priv boolean isFxApplicationThread() | |
| isRunning | back to summary |
|---|---|
| public final boolean isRunning() Implements javafx. Doc from javafx. True if the state is either SCHEDULED or RUNNING. When binding a Worker to a
| |
| messageProperty | back to summary |
|---|---|
| public final ReadOnlyStringProperty messageProperty() Implements javafx. Doc from javafx. Gets the ReadOnlyStringProperty representing the message.
| |
| onCancelledProperty | back to summary |
|---|---|
| public final ObjectProperty The onCancelled event handler is called whenever the Task state transitions to the CANCELLED state.
| |
| onFailedProperty | back to summary |
|---|---|
| public final ObjectProperty The onFailed event handler is called whenever the Task state transitions to the FAILED state.
| |
| onReadyProperty | back to summary |
|---|---|
| public final ObjectProperty The onReady event handler is called whenever the Task state transitions to the READY state.
| |
| onRunningProperty | back to summary |
|---|---|
| public final ObjectProperty The onRunning event handler is called whenever the Task state transitions to the RUNNING state.
| |
| onScheduledProperty | back to summary |
|---|---|
| public final ObjectProperty The onSchedule event handler is called whenever the Task state transitions to the SCHEDULED state.
| |
| onSucceededProperty | back to summary |
|---|---|
| public final ObjectProperty The onSucceeded event handler is called whenever the Task state transitions to the SUCCEEDED state.
| |
| progressProperty | back to summary |
|---|---|
| public final ReadOnlyDoubleProperty progressProperty() Implements javafx. Doc from javafx. Gets the ReadOnlyDoubleProperty representing the progress.
| |
| ready | back to summary |
|---|---|
| protected void ready() A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the READY state. This method is invoked after the Service has been fully transitioned to the new state.
| |
| removeEventFilter | back to summary |
|---|---|
| public final <T extends Event> void removeEventFilter(final EventType<T> eventType, final EventHandler<? super T> eventFilter) Overrides default javafx. Doc from javafx. Unregisters a previously registered event filter from this target.
Since it is possible to register a single
| |
| removeEventHandler | back to summary |
|---|---|
| public final <T extends Event> void removeEventHandler(final EventType<T> eventType, final EventHandler<? super T> eventHandler) Overrides default javafx. Doc from javafx. Unregisters a previously registered event handler from this target.
Since it is possible to register a single
| |
| reset | back to summary |
|---|---|
| public void reset() Resets the Service. May only be called while in one of the finish states, that is, SUCCEEDED, FAILED, or CANCELLED, or when READY. This method should only be called on the FX application thread. | |
| restart | back to summary |
|---|---|
| public void restart() Cancels any currently running Task, if any, and restarts this Service. The state will be reset to READY prior to execution. This method should only be called on the FX application thread. | |
| runLater | back to summary |
|---|---|
| pack-priv void runLater(Runnable r) | |
| running | back to summary |
|---|---|
| protected void running() A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the RUNNING state. This method is invoked after the Service has been fully transitioned to the new state.
| |
| runningProperty | back to summary |
|---|---|
| public final ReadOnlyBooleanProperty runningProperty() Implements javafx. Doc from javafx. Gets the ReadOnlyBooleanProperty representing whether the Worker is running.
| |
| scheduled | back to summary |
|---|---|
| protected void scheduled() A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the SCHEDULED state. This method is invoked after the Service has been fully transitioned to the new state.
| |
| setEventHandler | back to summary |
|---|---|
| protected final <T extends Event> void setEventHandler(final EventType<T> eventType, final EventHandler<? super T> eventHandler) Sets the handler to use for this event type. There can only be one such handler specified at a time. This handler is guaranteed to be called first. This is used for registering the user-defined onFoo event handlers.
| |
| setExecutor | back to summary |
|---|---|
| public final void setExecutor(Executor value) | |
| setOnCancelled | back to summary |
|---|---|
| public final void setOnCancelled(EventHandler<WorkerStateEvent> value) The onCancelled event handler is called whenever the Task state transitions to the CANCELLED state.
| |
| setOnFailed | back to summary |
|---|---|
| public final void setOnFailed(EventHandler<WorkerStateEvent> value) The onFailed event handler is called whenever the Task state transitions to the FAILED state.
| |
| setOnReady | back to summary |
|---|---|
| public final void setOnReady(EventHandler<WorkerStateEvent> value) The onReady event handler is called whenever the Task state transitions to the READY state.
| |
| setOnRunning | back to summary |
|---|---|
| public final void setOnRunning(EventHandler<WorkerStateEvent> value) The onRunning event handler is called whenever the Task state transitions to the RUNNING state.
| |
| setOnScheduled | back to summary |
|---|---|
| public final void setOnScheduled(EventHandler<WorkerStateEvent> value) The onSchedule event handler is called whenever the Task state transitions to the SCHEDULED state.
| |
| setOnSucceeded | back to summary |
|---|---|
| public final void setOnSucceeded(EventHandler<WorkerStateEvent> value) The onSucceeded event handler is called whenever the Task state transitions to the SUCCEEDED state.
| |
| start | back to summary |
|---|---|
| public void start() Starts this Service. The Service must be in the READY state to succeed in this call. This method should only be called on the FX application thread. | |
| stateProperty | back to summary |
|---|---|
| public final ReadOnlyObjectProperty Implements javafx. Doc from javafx. Gets the ReadOnlyObjectProperty representing the current state.
| |
| succeeded | back to summary |
|---|---|
| protected void succeeded() A protected convenience method for subclasses, called whenever the state of the Service has transitioned to the SUCCEEDED state. This method is invoked after the Service has been fully transitioned to the new state.
| |
| titleProperty | back to summary |
|---|---|
| public final ReadOnlyStringProperty titleProperty() Implements javafx. Doc from javafx. Gets the ReadOnlyStringProperty representing the title.
| |
| totalWorkProperty | back to summary |
|---|---|
| public final ReadOnlyDoubleProperty totalWorkProperty() Implements javafx. Doc from javafx. Gets the ReadOnlyDoubleProperty representing the maximum amount of work that needs to be done. These "work units" have meaning to the Worker implementation, such as the number of bytes that need to be downloaded or the number of images to process or some other such metric.
| |
| valueProperty | back to summary |
|---|---|
| public final ReadOnlyObjectProperty Implements javafx. Doc from javafx. Gets the ReadOnlyObjectProperty representing the value.
| |
| workDoneProperty | back to summary |
|---|---|
| public final ReadOnlyDoubleProperty workDoneProperty() Implements javafx. Doc from javafx. Gets the ReadOnlyDoubleProperty representing the current progress.
| |