faces
faces copied to clipboard
Add GroupConversationScoped
Deltaspike implemented this scope on top of the WindowScope. It would be awesome if JSF could deliver a similar scope out of the box. One problem with the Deltaspike implementation is, that there is no expiration handling. I'd like to be able to define a limit on the amount of groups that can be active and destroy the least recently used groups first when reaching that limit, to prevent out of memory scenarios.
@beikov what do you need exactly? i never seen any user who really uses it, not sure if we should put such features into the spec same like flows... very complex feature and almost unused
we currently talk in the DS mailing list about which features can be moved the spec itself and what stays in a DS 2.0
Well maybe nobody did use it really because it was lacking a timeout feature that I had to implement myself ;)
So my use case is that I have an app where people sometimes navigate quickly from one page or even one window to another. Back then I was using ViewAccessScoped
which was problematic, because beans were removed too early in such concurrent request scenarios when responses didn't fully finish yet from earlier requests. Here an example:
- User starts with Page 1 and runs a few ajax requests on-load which take a bit longer.
- Before the requests finished, user navigates to a Page 2 which renders fast
- All sub-requests from Page 1 finish on the server side and cleanup the view access scope, removing beans from Page 2
- User tries to click on something on Page 2 causing an ajax event
What happens then is that the bean for Page 2 is re-created because it was removed before. Unfortunately, this state loss leads to exceptions (can't fully remember which), but I guess you can see from this example that ViewAccessScope
is simply broken.
So I thought about using WindowScope
instead but after a few out of memory errors in production, due to no configurable upper limit of beans/groups or an idle-retention time, I had to look into something more production ready.
In this application, I knew that we only needed the state of a "few" pages of the past hence why we used ViewAccessScope
before. GroupedConversationScoped was attractive because it was running per window and allowed to group together multiple related beans so that these could be removed all at once. The only lacking feature in DS was an "idle timeout" and a maximum bean/group count. But I was able to extend it and implement a filter that did all the maintenance work.
IMO this customized version is the ultimate scope for JSF solving not only memory issues, but also various concurrency related problems.