webfirmframework for Java Experts

Multi-threading for lazy loading of tags/attributes of template

How to lazily load specific tags/attributes in the ui

Since wffweb-2.1.5, it supports multi-threading. This will help to asynchronously load ui for better user experience. A user specific example is a large form containing many select fields (drop down box of countries, vehicles, fruits etc..). In a single threaded model, the other parts of the form can not be generated while the select box is being filled by elements. So if we are using separate thread for generating select boxes then the user will feel like the entire UI is quickly loaded and the select boxes are being asynchronously filled with elements. This is a simple use case, there are many use cases where you want to load the overall UI first and after that asynchronously load different section of it. There are many major multi-threading improvements done till wffweb-12.0.6, use wffweb-12.0.7 or later to get best thread-safety.

You can find sample code for muti-threaded UI in this project. (Use Virtual Thread if you are using Java 21 or later.)

Creating lot of threads may not be a good approach as it may consume more memory and CPU so we are handling it with thread pool. Java Virtual Threads is available since Java 21. We can develop more user experienced UI with Java Virtual Threads. We will be able to create millions of Virtual Threads without the overhead of traditional thread.