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.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
What to do when UI is not attached?
Hi everyone!
I have the following situation. In my app i update some controls values periodically using Java's TimerTask.
The updation method looks like this:
public void updateDates() {
if(!myUI.get().isAttached())
return;
myUI.get().access(() -> {
isAsyncUpdate = true;
resetUnmodified();
isAsyncUpdate = false;
myUI.get().push();
});
}
Ok, once the user logs in everything is being update w/o any problems. Assume that user logs out and then the same user logs in. And after that the isAttached() method return false.
I can't understand why this happens and how to overcome this(
How can I resolve this issue?
Thanks in advance for any help
where are you creating your timer ?
an ui will be detached when the page is close or refresh.
maybe you should remove your timer when the ui detached.
you can override the detach method in ui to do that.
@Override
public void detach() {
//your code for closing you timer
super.detach(); //DONT REMOVE THAT
}
Hi Alain!
Thanks a lot for the suggestion. I refactored some classes and issue, it seems, passed away.
Thanks for your assist.