lehmann at media-interactive.de
Tue Apr 2 10:20:21 PDT 2013
As far as I understand this, javafx.concurrent.Task exists to simplify
communication between a background thread and the FX application thread.
It is basically its main or sole purpose.
If you don't want this you can still use a plain FutureTask (which it
extends). Then of course you are on your own with runLater's sprinkled
throughout the code to update progress, message, and GUI status after
On 02.04.2013 18:25, Daniel Zwolenski wrote:
> Just on the topic, I've had situations where I've wanted Tasks (and
> Services) to run in my own threading model (e.g. for unit testing). So I've
> had similar wants to Mark's original request (but not directly with
> Platform.runLater, though that may also be useful).
> It would be nice if the Task API was really just a way of saying what I
> want done at each stage (i.e. doThisStuffBefore, doTaskStuff,
> doThisStuffAfter), then I could/should be able to call those methods
> directly myself from my own execution framework that may or may not be FX
> related or even thread related (in much the same way Runnable doesnt
> necessairly have anything to do with Threads).
>> From memory this wasnt (cleanly/easily) achievable because of the tight
> interdependency between Tasks and the FX threading model and property
> change events, etc.
> A couple of use cases:
> - unit or integration testing, where I want to make sure certain
> things/tasks happen in a certain sequence.
> - reusing tasks (particularly the background bit of them) outside of JFX
> eg. reuse of REST style calls in an Android, Swing, Command line, GWT, or
> AJAX based app (Java compiled to JScript).
More information about the openjfx-dev