/ DataFX / DataFX: ObservableExecutor Preview

DataFX: ObservableExecutor Preview

Hendrik on 2013/02/09 - 13:16 in DataFX, JavaFX

Since December we are working on a new DataFX version. DataFX will provide a new low level API for multithreading and background tasks in JavaFX. With this API everyone can create new and custom DataSources that will fetch data in background and publish it to JavaFX properties (like you can do with the SwingWorker in Swing). Additionally we will provide some basic concurrency features like the invokeAndWait-method.

Next to this features we created a new Executor class that offers some additional features for the use with JavaFX. The ObservableExecutor holds a ListProperty with all currently scheduled or running tasks. By using this Property you can easily observe all tasks in your UI. We will provide a ListCell class to visualize the running tasks of the executor with only a few lines of code:

The ObservableExecutor uses the wrapper pattern to hold any Executor. Because all task are wrapped into Services you can easily access the title, message or progress of any task. A short example that shows the current state of the API can be found here:

Because Runnable & Callable normally do not provide title, message and progress properties we created extended interfaces (DataFXRunnable & DataFXCallable) where all this functions are injected while using them with the ObservableExecutor.
At the current state tasks can be passed to an ObservableExecutor by the following methods:

There are some additional features, too. You can mark a task as not cancelable for example.
Hope you like this stuff!


Send Us A Message Here

Your email address will not be published. Required fields are marked *

  • 2013/03/25

    Keep functioning ,great job!

  • 2015/05/08

    Is the src for this somewhere? I tried to wrap a listdataprovider in DatafxRunnable so could observer it the executor but getting errors. I know can pass executor to Listdataprovider. But there know titles assigned or anything is there better way.

    Jason Weh