Virtual Threads

It was an interesting read about virtual threads and Vaadin

In order for this to be useful it has to be easy to use from Vaadin Flow, but the solution in the article was using private API and still exploratory.

For AWT it was suggested a long time ago to use another way of creating a factory for virtual threads (see image), but it may be outdated by now and not sure if something similar can be used with Flow?

Virtual Threads are soon released with Java 21 and I know they are mostly beneficial for I/O-bound concurrency but this topic is still interesting I think in the context of Vaadin Flow and the UI thread.

I have the feeling you are mixing two things here. The example with the dialog and virtual threads.

I personally would think that virtual threads are going to work out of the box with Vaadin once the underlying servlet container support it (Spring Boot / Tomcat are working on it / are releasing it at the moment) once that’s done, I doubt that there is much code change needed in Vaadin Flow

No the idea that Martin is exploring in the article is based on Virtual Threads as a way of avoiding callbacks for UI related tasks

One thing to take into account is that Vaadin can’t easily embrace anything that’s only in the latest JDK version as long as the minimum supported version is JDK 17 (like it is for Vaadin 24)

For example, Java Records were introduced in Java 14, so they can’t be used in the Vaadin 23 API, because Vaadin 23 promises to work with Java 11

(and quite a lot of Vaadin users have difficulties in upgrading their environments for various reasons, so only supporting the latest is not a great option either)