VaadinPortlet should implement destroy() #3688

Closed
vaadin-bot opened this Issue Mar 19, 2013 · 2 comments

Projects

None yet

1 participant

@vaadin-bot
Collaborator

Originally by dnebing


VaadinPortlet does not implement destroy() so the CurrentInstance leaves artifacts in memory (memory leak) when destroyed.

VaadinPortlet should implement the destroy() method and should invoke a new method on CurrentInstance to clean up and destroy the thread local.


Imported from https://dev.vaadin.com/ issue #11372

@vaadin-bot
Collaborator

Originally by dnebing


Should also probably add a portletDestroyed() method to allow subclasses to clean up resources, modeled after the portletInitialized() method to allow subclasses to initialize themselves.

@vaadin-bot
Collaborator

Originally by @Legioth


Clearing CurrentInstance in destroy() would only clean up the ThreadLocal of the thread where destroy() is run whereas any leaked CurrentInstance on other threads would still be there. The ThreadLocal API does not seem to allow accessing a ThreadLocal of another thread.

The correct way of avoiding leaks is to make sure CurrentInstance.clearAll() is run in a finally block in all places where there might be code that has set any instance. #11906 will fix this for VaadinServlet.init() and VaadinPortlet.init().

Please create separate tickets for any other situations where CurrentInstance.clearAll() might be missing.

@vaadin-bot vaadin-bot closed this May 23, 2013
@vaadin-bot vaadin-bot added the bug label Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment