[jboss-user] [JBoss Seam] - Re: Question about conversations
do-not-reply at jboss.com
Fri Feb 16 18:18:58 EST 2007
Case 2 is usally handled by conversations timing out. So if the user navigates away and doesn't come back (using the Back button) then the conversation will eventually die and clean up it's state.
If the user navigates back to the page (not using the back button) then they will not pick up the active conversation by default. Instead it will start a new conversation assuming there is a @Begin or equivalent somewhere.
Maybe an example...
Say the user is on a search screen, they search for something and decide to edit an item.
The view changes to the edit view and a conversation (1) is started. The user makes a few changes in the browser form but decides not to finish the edit and uses the back button to return to the search screen.
User clicks the same item again from the search screen, view changes to the edit view and a new conversation (2) is started. Note the user will not see the changes they made in conversation (1) as the changes were not saved.
So now there are two active conversations both on the edit view of the same item. Perfectly valid, if a little tricky to get your head round.
User makes some edits to the item in conversation (2) and hits update. View redirects to the search.
User wanders off for a cup of tea.
Conversation (1) times out and silently dies (get cleaned up on the next request).
So although there were two conversations editing the same item they didn't get in each others way and the discarded conversation died without any nasty side-effects or cleanup code.
The only possibility of something messing up here is if the user managed to get back to conversation (1) (using the conversation switcher) and save some changes, in which case I would be trusting my database layer to throw a versioning/stale data error on the second update.
Note that this is EXACTLY the same as if two users on separate machines/server sessions decided to try and edit the same item at the same time so this isn't a Seam issue, just the price you pay for optimistic locking.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017948#4017948
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017948
More information about the jboss-user