|Reload of RAP application in browser [message #1775933]
||Wed, 08 November 2017 11:45
| Gunnar Adams
Registered: May 2016
our application needs to be able to survive the user pressing the reload button or F5 in the browser.
In the design of our application we wrapped all widgets within logical components, which have methods like
createWidget(), creates the component's widget (and ancestor widgets, if required)
destroyWidget(), disposes the component's widget,
recreateWidget(), disposes and creates the component's widget.
and in addition to that methods like isWidgetAllocated (returns true, if the widget is currently assigned and false, if it isn't).
The top level component of the component tree is stored with the HttpSession and can be used to recreate the whole widget tree in case the Entrypoint is called again for the same HttpSession.
This will create a new UISession object.
We are now facing the problem, that the old UISession object, which was active before pressing "Reload" remains connected to the existing widget tree. In some (not all) cases, this leads to Server errors due to Invalid Thread access from within the old UISession. It seems to depend on timing, which is also the reason why we detected this problem at a very late stage in the development process.
What is the best way to handle the death of an old UISession due to pressing Reload in the browser? We know about UISessionListener but have not yet fully understood the exact timing when the event is sent. How does the RAP servlet detect, that the UISession is no longer valid? Will this lead to widgets "belonging to the old UISession" being disposed (notifying disposeListeners in the model)?
Unregistering the disposeListeners (and other Listeners) does not seem to be an option from within the new UISession.
Is it ok for our logical model to "forget" about all widgets and recreate them in the new UISession or will this lead to memory leaks? What kind of automatic cleanup does the UISession perform during it's destruction?
It is my understanding that the old UISession is no longer required. So we are looking for a way to severe all ties to the old UISession at the correct point in time.
Thanks a lot for your input
Powered by FUDForum
. Page generated in 0.01645 seconds