You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/12/29 18:47:38 UTC

tomee git commit: avoid BusyConversationException issue in destroy request - we should do something more clever here surely enriching OWB API

Repository: tomee
Updated Branches:
  refs/heads/develop bf851e2b5 -> f112bdd7b


avoid BusyConversationException issue in destroy request - we should do something more clever here surely enriching OWB API


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f112bdd7
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f112bdd7
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f112bdd7

Branch: refs/heads/develop
Commit: f112bdd7b74297d61175dc640c1f8119663a49b2
Parents: bf851e2
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Mon Dec 29 18:46:48 2014 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Mon Dec 29 18:46:48 2014 +0100

----------------------------------------------------------------------
 .../openejb/cdi/CdiAppContextsService.java      | 26 ++++++++++++++------
 tck/cdi-embedded/src/test/resources/failing.xml |  2 +-
 .../tomee/catalina/OpenEJBContextConfig.java    |  3 ++-
 3 files changed, 21 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/f112bdd7/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
index 1a6ce55..7b91dbe 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
@@ -403,9 +403,15 @@ public class CdiAppContextsService extends AbstractContextsService implements Co
     }
 
     private void cleanupConversation() {
-        if (conversationService == null || getConversationContext(false) == null) {
+        if (conversationService == null) {
+            return;
+        }
+
+        final ConversationContext cc = getConversationContext(false);
+        if (cc == null) {
             return;
         }
+        cc.setActive(false);
 
         final ConversationManager conversationManager = webBeansContext.getConversationManager();
         final Conversation conversation = conversationManager.getConversationBeanReference();
@@ -413,13 +419,17 @@ public class CdiAppContextsService extends AbstractContextsService implements Co
             return;
         }
 
-        if (conversation.isTransient()) {
-            endContext(ConversationScoped.class, null);
-            conversationManager.removeConversation(conversation); // in case end() was called
-        } else {
-            final ConversationImpl conversationImpl = (ConversationImpl) conversation;
-            conversationImpl.updateTimeOut();
-            conversationImpl.iDontUseItAnymore();
+        final ConversationImpl conversationImpl = ConversationImpl.class.cast(conversation);
+        conversationImpl.iDontUseItAnymore(); // do it before next call to avoid busy exception if possible
+        try {
+            if (conversation.isTransient()) {
+                endContext(ConversationScoped.class, null);
+                conversationManager.removeConversation(conversation); // in case end() was called
+            } else {
+                conversationImpl.updateTimeOut();
+            }
+        } catch (final BusyConversationException bce) {
+            // no-op, TODO: do something, maybe add internalIsTransient() to avoid to fail here
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/f112bdd7/tck/cdi-embedded/src/test/resources/failing.xml
----------------------------------------------------------------------
diff --git a/tck/cdi-embedded/src/test/resources/failing.xml b/tck/cdi-embedded/src/test/resources/failing.xml
index 0dfccb1..aed8972 100644
--- a/tck/cdi-embedded/src/test/resources/failing.xml
+++ b/tck/cdi-embedded/src/test/resources/failing.xml
@@ -26,7 +26,7 @@
     -Dopenejb.deploymentId.format={appId}/{ejbJarId}/{ejbName}
     -->
     <classes>
-      <class name="org.jboss.cdi.tck.tests.decorators.builtin.http.session.BuiltinHttpSessionDecoratorTest" />
+      <class name="org.jboss.cdi.tck.tests.context.conversation.filter.ConversationFilterTest" />
     </classes>
   </test>
 </suite>

http://git-wip-us.apache.org/repos/asf/tomee/blob/f112bdd7/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
index 6ba844b..26bcdb1 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
@@ -355,8 +355,9 @@ public class OpenEJBContextConfig extends ContextConfig {
             final FilterDef filter = new FilterDef();
             filter.setAsyncSupported("true");
             filter.setDescription("OpenEJB CDI Filter - to propagate @RequestScoped in async tasks");
-            filter.setDisplayName("OpenEJB_CDI");
+            filter.setDisplayName("OpenEJB CDI");
             filter.setFilterClass(WebBeansFilter.class.getName());
+            filter.setFilterName(WebBeansFilter.class.getName());
             webXml.addFilter(filter);
 
             final FilterMap mapping = new FilterMap();