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 some major multi-threading improvements done in wffweb-3.0.1, use wffweb-3.0.1 or later.

You can find sample code for muti-threaded UI in this project.

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. But a good news is that we can forget about this problem after the arrival of Java Virtual Threads. We can develop more user experienced UI with Java Virtual Threads proposed in Java Loom project. We will be able to create millions of Virtual Threads without the overhead of traditional thread.