Author: dan.j.allen
Date: 2009-04-09 20:00:29 -0400 (Thu, 09 Apr 2009)
New Revision: 10376
Modified:
trunk/src/main/org/jboss/seam/core/Manager.java
trunk/src/main/org/jboss/seam/persistence/ManagedEntityWrapper.java
Log:
JBSEAM-2209 introduce a switchConversation() method that does not promote to a
long-running conversation
then use this method in the ManagedEntityWrapper to avoid promoting a previously demoted
conversation
Modified: trunk/src/main/org/jboss/seam/core/Manager.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/Manager.java 2009-04-09 23:59:13 UTC (rev 10375)
+++ trunk/src/main/org/jboss/seam/core/Manager.java 2009-04-10 00:00:29 UTC (rev 10376)
@@ -765,13 +765,26 @@
}
/**
- * Switch to another long-running conversation.
+ * Switch to another long-running conversation and mark the conversation as
long-running,
+ * overriding a previous call in the same thread to demote a long-running
conversation.
*
* @param id the id of the conversation to switch to
* @return true if the conversation exists
*/
public boolean switchConversation(String id)
{
+ return switchConversation(id, true);
+ }
+
+ /**
+ * Switch to another long-running conversation.
+ *
+ * @param id the id of the conversation to switch to
+ * @param promote promote the current conversation to long-running, overriding any
previous demotion
+ * @return true if the conversation exists
+ */
+ public boolean switchConversation(String id, boolean promote)
+ {
ConversationEntry ce = ConversationEntries.instance().getConversationEntry(id);
if (ce!=null)
{
@@ -780,7 +793,10 @@
unlockConversation();
setCurrentConversationId(id);
setCurrentConversationIdStack( ce.getConversationIdStack() );
- setLongRunningConversation(true);
+ if (promote)
+ {
+ setLongRunningConversation(true);
+ }
return true;
}
else
Modified: trunk/src/main/org/jboss/seam/persistence/ManagedEntityWrapper.java
===================================================================
--- trunk/src/main/org/jboss/seam/persistence/ManagedEntityWrapper.java 2009-04-09
23:59:13 UTC (rev 10375)
+++ trunk/src/main/org/jboss/seam/persistence/ManagedEntityWrapper.java 2009-04-10
00:00:29 UTC (rev 10376)
@@ -233,7 +233,7 @@
if (!currentCid.equals(residentCid))
{
Contexts.getConversationContext().flush();
- Manager.instance().switchConversation(residentCid);
+ Manager.instance().switchConversation(residentCid, false);
return currentCid;
}
}
@@ -246,7 +246,7 @@
if (oldCid != null)
{
Contexts.getConversationContext().flush();
- Manager.instance().switchConversation(oldCid);
+ Manager.instance().switchConversation(oldCid, false);
}
}