You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2013/05/26 21:47:20 UTC

[jira] [Resolved] (DELTASPIKE-293) Improve the ViewScopedContext by observing ServletContext and HttpSession lifecycle events.

     [ https://issues.apache.org/jira/browse/DELTASPIKE-293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg resolved DELTASPIKE-293.
--------------------------------------

    Resolution: Won't Fix
      Assignee: Mark Struberg

Hi!

I think this is not easily fixable. The ViewMap might as well be stored on the ClientSide. Thus we just have no idea whether we do have a session boundary at all, etc. Please note that the destroyal of any Serializable bean is not a 100% safe bet. 
E.g. even @SessionScoped beans could not be reliable. Just think about the session being serialized away to another node and then shutting down the server. Or having session-passivation to disk and then deleting the storage, etc.

We can just rely on the JSF container and hope for the best. In case of MyFaces we will also get this event if the ViewMap gets destroyed after a SessionTimeout. I'm not sure about Mojarra though. 
                
> Improve the ViewScopedContext by observing ServletContext and HttpSession lifecycle events.
> -------------------------------------------------------------------------------------------
>
>                 Key: DELTASPIKE-293
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-293
>             Project: DeltaSpike
>          Issue Type: Improvement
>          Components: JSF-Module
>    Affects Versions: 0.4-incubating
>            Reporter: Radu Creanga
>            Assignee: Mark Struberg
>             Fix For: 0.5
>
>
> The CDI specification states that Context implementations are responsible for destroying instances it creates. The current ViewScopedContext relies on PreDestroyViewMapEvents to be notified when a view map is destroyed. But, the JSF 2.0 and 2.1 spec only fire this event when a view map is replaced. This means that in most cases, instances created by ViewScopedContext are not properly destroyed. The ViewScopedContext should be observing ServletContext and HttpSession lifecycle events instead in order to ensure that all instances it creates are properly destroyed. Visible improvements resulting out of this would be that the @PostConstruct method of @ViewScoped beans is invoked. Additionally, this will probably result in better memory usage, since instances that are not properly destroyed are not eligible for GC.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira