Refresher or java.util.Timer

I have a situation that I have to poll the backend every X msec and the update the UI with the fresh backend data.
user (the one that activates this specific window) should get the refreshed data. (The refresh action is actually changing the value of a Label).
Here is my question:
Should I go with
or java.util.Timer will be enough?



Timer run on server side which can not refresh the UI automatically. It will also not provide any thread safety if you decide to change the UI (you need to synchronize yourself)
Refresher runs on both sides (a script on client and a listener on server) and so can refresh the UI. As it runs into main Vaadin thread there is no risk of race condition here.

So in your case, you should go with the refresher.

For more details on polling, pushing and background UI updates see
this sticky
for a good explanation.

I will have a look there.