Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to synchronize the thread in vaadin for different user
In my vaadin application , i have a class with thread as a inner class. The enclosed class is a panel.If i create six objects of that enlcosing class , there will be
six panel in my home page.Each are having seperate threads because that enclosing class as a inner thread class.
I changed the panel color according to the database table data . Selected panel is in green color .Other panels are in red color.
For example if one user selects first panel then it will be shown to another user by changing the color of the panel to green .So both user have one green panel and all
other panels are in red color.If again one user selects any other panel it will be changed to green color. For every selection in the panel , i put one record in the database table.I delete the record when user logged out from the application and the panel color should be red.
The problem is that if any of the user is logged out from the application the panel color does not change . But i checked all the threads whether it is running or not.
It is in running state. But the color didn't change.Actually i used the refresher for immediate changing to the user.
I synchronize the thread run method by using synchronized keyword. But it doesn't work well.
Please give some solution.
Please redesign your application. If I understood correctly you are creating Java threads one for each of the Panel instances. So six separate threads for each of the user. What are you trying to do in the separate threads.
Johannes Häyry: Please redesign your application. If I understood correctly you are creating Java threads one for each of the Panel instances. So six separate threads for each of the user. What are you trying to do in the separate threads.
Hi sir ,
Actually One java thread class.If i create six instance for that thread class ,there will be six threads running for six panel instance.
The fault is mine.I didn't initialize an int array in the loop. This was the problem which means this was not a vaadin problem.
Thank you sir for your quick reply.