[JBoss JIRA] (CDI-732) Clarify that the Context for RequestScoped must be active during @PreDestroy calls
by Benjamin Confino (JIRA)
[ https://issues.jboss.org/browse/CDI-732?page=com.atlassian.jira.plugin.sy... ]
Benjamin Confino commented on CDI-732:
--------------------------------------
Unless I am mistaken there is a rule that a session scope should remain active until all the associated requests are finished. The spec says a session context is destroyed "and at the very end of any request in which invalidate() was called" - keywords "very end", but I think even if it didn't call invalidate() sessions always last until the very end of their associated requests.
This to me suggests RequestScoped beans will be destroyed first, and thus it makes sense that they're not available during the PreDestroy of a SessionScope bean. However from my perspective it doesn't matter which is destroyed first, so long as the spec is updated to define the order.
> Clarify that the Context for RequestScoped must be active during @PreDestroy calls
> ----------------------------------------------------------------------------------
>
> Key: CDI-732
> URL: https://issues.jboss.org/browse/CDI-732
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Contexts
> Affects Versions: 2.0 .Final
> Reporter: Mark Struberg
>
> We have the explicit rule that the Context for @RequestScoped must be active during @PostConstruct of any bean.
> But it seems we don't force the same for invocations of @PreDestroy methods.
> That's especially weird since a few containers now blow up during a destroyal of a @SessionScopedBean which has a @RequestScoped Principal injected, even if the session destroyal was triggered by an explicit Session#invalidate() call in an open HTTP request.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months
[JBoss JIRA] (CDI-732) Clarify that the Context for RequestScoped must be active during @PreDestroy calls
by Matej Novotny (JIRA)
[ https://issues.jboss.org/browse/CDI-732?page=com.atlassian.jira.plugin.sy... ]
Matej Novotny commented on CDI-732:
-----------------------------------
This can be tricky because we do not know in what order should we destroy those "HTTP-related" scopes(e.g. session, request and conversation). Spec doesn't mention it and according to what you write I presume implementations differ already.
Based on this premise it may not make sense to have it active, at least not in all cases - for instance if you were to destroy request scoped beans before session scope ones, you would need to recreate those req. beans just to have them available in {{@PreDestroy}} of session scope bean.
> Clarify that the Context for RequestScoped must be active during @PreDestroy calls
> ----------------------------------------------------------------------------------
>
> Key: CDI-732
> URL: https://issues.jboss.org/browse/CDI-732
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Contexts
> Affects Versions: 2.0 .Final
> Reporter: Mark Struberg
>
> We have the explicit rule that the Context for @RequestScoped must be active during @PostConstruct of any bean.
> But it seems we don't force the same for invocations of @PreDestroy methods.
> That's especially weird since a few containers now blow up during a destroyal of a @SessionScopedBean which has a @RequestScoped Principal injected, even if the session destroyal was triggered by an explicit Session#invalidate() call in an open HTTP request.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months
[JBoss JIRA] (CDI-732) Clarify that the Context for RequestScoped must be active during @PreDestroy calls
by Mark Struberg (JIRA)
Mark Struberg created CDI-732:
---------------------------------
Summary: Clarify that the Context for RequestScoped must be active during @PreDestroy calls
Key: CDI-732
URL: https://issues.jboss.org/browse/CDI-732
Project: CDI Specification Issues
Issue Type: Feature Request
Components: Contexts
Affects Versions: 2.0 .Final
Reporter: Mark Struberg
We have the explicit rule that the Context for @RequestScoped must be active during @PostConstruct of any bean.
But it seems we don't force the same for invocations of @PreDestroy methods.
That's especially weird since a few containers now blow up during a destroyal of a @SessionScopedBean which has a @RequestScoped Principal injected, even if the session destroyal was triggered by an explicit Session#invalidate() call in an open HTTP request.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months