CHAPTER 27

image

Understanding Concurrency in JavaFX

In this chapter, you will learn:

  • Why you need a concurrency framework in JavaFX
  • How the Worker<V> interface represents a concurrent task
  • How to run a one-time task
  • How to run a reusable task
  • How to run a scheduled task

The Need for a Concurrency Framework

Java (including JavaFX) GUI (graphical user interface) applications are inherently multithreaded. Multiple threads perform different tasks to keep the UI in sync with the user actions. JavaFX, like Swing and AWT, uses a single thread, called JavaFX Application Thread, to process all UI events. The nodes representing UI in a scene graph are not thread-safe. ...

Get Learn JavaFX 8: Building User Experience and Interfaces with Java 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.