You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2010/03/25 13:22:27 UTC

[jira] Created: (OWB-337) events must not get broadcasted to beans which have no active Context

events must not get broadcasted to beans which have no active Context
---------------------------------------------------------------------

                 Key: OWB-337
                 URL: https://issues.apache.org/jira/browse/OWB-337
             Project: OpenWebBeans
          Issue Type: Bug
    Affects Versions: M4
            Reporter: Mark Struberg
            Assignee: Mark Struberg
            Priority: Minor
             Fix For: 1.0.0


If someone fires an Event, we currently deliver it to all contextual instances of beans which are registered for that event, even if those beans are in a context which is not active yet.

This happens for example in the following situation:

A 
UserLogOutFilter implements javax.servlet.Filter
 sends a UserSettingsChangeEvent.

A @ConversationScoped MyBusinessBean @Observes UserSettingsChangeEvent.

But at the time the servlet filter does run, there is no active ConversationContext yet. This leads to the following Exception:

javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @ConversationScoped does not exist within current thread
	at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:279)
	at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:201)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-337) events must not get broadcasted to beans which have no active Context

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849772#action_12849772 ] 

Gurkan Erdogdu commented on OWB-337:
------------------------------------

>>>The spec is designed to only maintain 1 Context instance for 1 scope.
1 current Context for 1 scope and this is how we handle contexts.

> events must not get broadcasted to beans which have no active Context
> ---------------------------------------------------------------------
>
>                 Key: OWB-337
>                 URL: https://issues.apache.org/jira/browse/OWB-337
>             Project: OpenWebBeans
>          Issue Type: Bug
>    Affects Versions: M4
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> If someone fires an Event, we currently deliver it to all contextual instances of beans which are registered for that event, even if those beans are in a context which is not active yet.
> This happens for example in the following situation:
> A 
> UserLogOutFilter implements javax.servlet.Filter
>  sends a UserSettingsChangeEvent.
> A @ConversationScoped MyBusinessBean @Observes UserSettingsChangeEvent.
> But at the time the servlet filter does run, there is no active ConversationContext yet. This leads to the following Exception:
> javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @ConversationScoped does not exist within current thread
> 	at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:279)
> 	at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:201)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-337) events must not get broadcasted to beans which have no active Context

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849762#action_12849762 ] 

Mark Struberg commented on OWB-337:
-----------------------------------

Sadly in my case there is none :(

BeanManager.getContext() throws that very ContextNotActiveException above.

> What do you mean by saying 1 ConversationContext?
The spec is designed to only maintain 1 Context instance for 1 scope. This context does maintain different 'conversation storages' internally as we do with our ConversationManager. So there is no problem with any concurrency.

For now, I'll  catch this ContextNotActiveException in this special case.
But first I'll write to Gavin to clarify how it should behave from the conceptional view.

> events must not get broadcasted to beans which have no active Context
> ---------------------------------------------------------------------
>
>                 Key: OWB-337
>                 URL: https://issues.apache.org/jira/browse/OWB-337
>             Project: OpenWebBeans
>          Issue Type: Bug
>    Affects Versions: M4
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> If someone fires an Event, we currently deliver it to all contextual instances of beans which are registered for that event, even if those beans are in a context which is not active yet.
> This happens for example in the following situation:
> A 
> UserLogOutFilter implements javax.servlet.Filter
>  sends a UserSettingsChangeEvent.
> A @ConversationScoped MyBusinessBean @Observes UserSettingsChangeEvent.
> But at the time the servlet filter does run, there is no active ConversationContext yet. This leads to the following Exception:
> javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @ConversationScoped does not exist within current thread
> 	at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:279)
> 	at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:201)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OWB-337) events must not get broadcasted to beans which have no active Context

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg resolved OWB-337.
-------------------------------

    Resolution: Fixed

> events must not get broadcasted to beans which have no active Context
> ---------------------------------------------------------------------
>
>                 Key: OWB-337
>                 URL: https://issues.apache.org/jira/browse/OWB-337
>             Project: OpenWebBeans
>          Issue Type: Bug
>    Affects Versions: M4
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> If someone fires an Event, we currently deliver it to all contextual instances of beans which are registered for that event, even if those beans are in a context which is not active yet.
> This happens for example in the following situation:
> A 
> UserLogOutFilter implements javax.servlet.Filter
>  sends a UserSettingsChangeEvent.
> A @ConversationScoped MyBusinessBean @Observes UserSettingsChangeEvent.
> But at the time the servlet filter does run, there is no active ConversationContext yet. This leads to the following Exception:
> javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @ConversationScoped does not exist within current thread
> 	at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:279)
> 	at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:201)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-337) events must not get broadcasted to beans which have no active Context

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849747#action_12849747 ] 

Mark Struberg commented on OWB-337:
-----------------------------------

This is exactly where we would need to only have 1 ConversationContext instance which we could ask for isActive()...


> events must not get broadcasted to beans which have no active Context
> ---------------------------------------------------------------------
>
>                 Key: OWB-337
>                 URL: https://issues.apache.org/jira/browse/OWB-337
>             Project: OpenWebBeans
>          Issue Type: Bug
>    Affects Versions: M4
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> If someone fires an Event, we currently deliver it to all contextual instances of beans which are registered for that event, even if those beans are in a context which is not active yet.
> This happens for example in the following situation:
> A 
> UserLogOutFilter implements javax.servlet.Filter
>  sends a UserSettingsChangeEvent.
> A @ConversationScoped MyBusinessBean @Observes UserSettingsChangeEvent.
> But at the time the servlet filter does run, there is no active ConversationContext yet. This leads to the following Exception:
> javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @ConversationScoped does not exist within current thread
> 	at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:279)
> 	at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:201)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-337) events must not get broadcasted to beans which have no active Context

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849751#action_12849751 ] 

Gurkan Erdogdu commented on OWB-337:
------------------------------------

What do you mean by saying 1 ConversationContext? Currently there is one and only one current conversation context for each client. 

You mean that all of the clients must share the same ConversationContext? I think that there is some misunderstanding here. What if two client start 2 different conversation and share same ConversationContext? 

You have to think about current context instead of global context. 

> events must not get broadcasted to beans which have no active Context
> ---------------------------------------------------------------------
>
>                 Key: OWB-337
>                 URL: https://issues.apache.org/jira/browse/OWB-337
>             Project: OpenWebBeans
>          Issue Type: Bug
>    Affects Versions: M4
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> If someone fires an Event, we currently deliver it to all contextual instances of beans which are registered for that event, even if those beans are in a context which is not active yet.
> This happens for example in the following situation:
> A 
> UserLogOutFilter implements javax.servlet.Filter
>  sends a UserSettingsChangeEvent.
> A @ConversationScoped MyBusinessBean @Observes UserSettingsChangeEvent.
> But at the time the servlet filter does run, there is no active ConversationContext yet. This leads to the following Exception:
> javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @ConversationScoped does not exist within current thread
> 	at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:279)
> 	at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:201)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.