Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Vaadin polling - best practice tutorial processes requesting objects (ui co

Kai Klostermann
5 years ago Oct 25, 2016 6:06am
Enver Haase
5 years ago Nov 04, 2016 3:25pm
Kai Klostermann
5 years ago Nov 07, 2016 7:38am
Enver Haase
5 years ago Nov 11, 2016 3:44pm

Thanks, Kai.

We're currently undergoing restructuring of parts of the website - as you can see the Wiki is write-protected for the time being. I have linked your improvement suggestion to the article you mentioned so this will be picked up by the restructuring team when it comes across it.

Best Regards,
--Enver
 

Steve B
5 years ago Dec 22, 2016 6:53am

There is a bug in the code on here and in the wiki. The last registered poll, once removed, never sets the polling interval back to -1 as the uiRequests in pollRequests.get(ui) will be null, and it is never handled. setPollInterval should be:

private void setPollInterval(UI ui)
    {
        Map<Object, Integer> uiRequests = pollRequests.get(ui);
        if (uiRequests != null)
        {
            ui.setPollInterval(getLowestNumber(uiRequests.values()));
        }else{
            ui.setPollInterval(-1);
        }
    }