[jboss-cvs] jboss-seam/src/main/org/jboss/seam/contexts ...
Norman Richards
norman.richards at jboss.com
Wed Sep 12 17:17:55 EDT 2007
User: nrichards
Date: 07/09/12 17:17:55
Modified: src/main/org/jboss/seam/contexts
ServerConversationContext.java
Log:
JBSEAM-1656
Revision Changes Path
1.33 +58 -36 jboss-seam/src/main/org/jboss/seam/contexts/ServerConversationContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ServerConversationContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/ServerConversationContext.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- ServerConversationContext.java 25 Jun 2007 21:02:55 -0000 1.32
+++ ServerConversationContext.java 12 Sep 2007 21:17:55 -0000 1.33
@@ -200,18 +200,44 @@
private Set<String> getNamesFromSession()
{
HashSet<String> results = new HashSet<String>();
- String prefix = getPrefix( getId() );
- for ( String name: session.keySet() )
- {
- if ( name.startsWith(prefix) )
+
+ String prefix = getPrefix(getId());
+ for (String name: session.keySet()) {
+ if (name.startsWith(prefix)) {
+ name = name.substring(prefix.length());
+ if (!removals.contains(name)) {
+ results.add(name);
+ }
+ }
+ }
+
+ return results;
+ }
+
+ private Set<String> getNamesForAllConversationsFromSession()
{
- name = name.substring( prefix.length() );
- if ( !removals.contains(name) ) results.add(name);
+ Set<String> results = new HashSet<String>();
+
+ List<String> ids = Manager.instance().getCurrentConversationIdStack();
+
+ if (ids != null) {
+ for (String conversationId: ids) {
+ String prefix = getPrefix(conversationId);
+ for (String name: session.keySet()) {
+ if (name.startsWith(prefix)) {
+ String shortName = name.substring(prefix.length());
+ if (!removals.contains(shortName)) {
+ results.add(name);
+ }
+ }
}
}
+ }
+
return results;
}
+
public Object get(Class clazz)
{
return get( Component.getComponentName(clazz) );
@@ -225,9 +251,8 @@
public void unflush()
{
- for ( String name: getNamesFromSession() )
+ for ( String key: getNamesForAllConversationsFromSession() )
{
- String key = getKey(name);
Object attribute = session.get(key);
if ( attribute!=null && attribute instanceof Wrapper )
{
@@ -246,27 +271,24 @@
public void flush()
{
boolean longRunning = !isCurrent() || Manager.instance().isLongRunningConversation();
+
if ( longRunning )
{
//force update for dirty mutable objects
- for ( String name: getNamesFromSession() )
- {
- String key = getKey(name);
+ for (String key: getNamesForAllConversationsFromSession()) {
Object attribute = session.get(key);
- if ( attribute!=null && isAttributeDirty(attribute) )
- {
+
+ if ( attribute!=null && isAttributeDirty(attribute) ) {
session.put(key, attribute);
}
}
//remove removed objects
- for (String name: removals)
- {
- session.remove( getKey(name) );
+ for (String name: removals) {
+ session.remove(getKey(name));
}
removals.clear();
//add new objects
- for (Map.Entry<String, Object> entry: additions.entrySet())
- {
+ for (Map.Entry<String, Object> entry: additions.entrySet()) {
session.put( getKey( entry.getKey() ), entry.getValue() );
}
additions.clear();
More information about the jboss-cvs-commits
mailing list