Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Singleton UnloadObserver should be thread-local #173

Closed
vaadin-miki opened this issue Jun 23, 2020 · 2 comments · Fixed by #175
Closed

Singleton UnloadObserver should be thread-local #173

vaadin-miki opened this issue Jun 23, 2020 · 2 comments · Fixed by #175
Assignees
Labels
invalid This doesn't seem right

Comments

@vaadin-miki
Copy link
Owner

The instance is shared across multiple instances of UI. It should probably be thread-local. There can only be one instance on the client-side, though.

@jflamy
Copy link

jflamy commented Jun 29, 2020

I believe that there is a problem with this approach (I may be reading the code wrong though). When a page is first served, it will be in thread 123 (say). The threadlocal variable will belong to that thread. Every time the page is updated, new threads are fired, but you are keeping a reference to the original thread, preventing 123 from being recovered.

My suggestions would be to attach the listener to the UI object -- it is the UI object that is being unloaded. Maybe using ComponentUtil.setData https://vaadin.com/api/platform/14.2.2/com/vaadin/flow/component/ComponentUtil.html#setData-com.vaadin.flow.component.Component-java.lang.Class-T-

@vaadin-miki vaadin-miki added invalid This doesn't seem right and removed bug Something isn't working labels Jul 1, 2020
@vaadin-miki
Copy link
Owner Author

this has been overridden by #178

vaadin-miki added a commit that referenced this issue Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants