Hi, I removed also the map containing the old views as weak references. It does not make any sense in my use case because my app does not support the browser back button. Moreover I think that this map with the weak references results in unpredictable behavior under load.
I am facing now a new problem without this old views caused by the sequence id in the SerializedViewKey. If I define numberOfViewsInSession=1 and a page is submitted multiple times with ajax then let's say request1 and reqest2 are submitted with sequenceId=1. This sequenceId is increased during processing of request1 from 1 to 2. The view of request2 can't be restored anymore because it is fired with sequenceId1 but the session counter is at 2! Therefore my question: Can I remove the sequenceId from SerializedViewKey if I do not support browser back button? From my point of view the weakMap and the sequenceId should not be used in case of numberOfViewsInSession=1 Michael -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Montag, 21. April 2008 16:37 To: MyFaces Discussion Subject: Re: Leak in saveState? wbirkhead schrieb: > Gerald Müllan-3 wrote: > >>> I can see that in some cases it may help, perhaps you wanna share the >>> >> impl ? >> >> I just removed the two lines with the weak references. So, only ugly >> duplication of code. :) >> >> >> > > Gerald, at the risk of sounding like a novice, can you point me to the lines > of code with the weak references that you mention above? This would be a > HUGE help. > JspStateManagerImpl has this method: public synchronized void add(FacesContext context, Object state) { Object key = new SerializedViewKey(context); _serializedViews.put(key, state); while (_keys.remove(key)); _keys.add(key); int views = getNumberOfViewsInSession(context); while (_keys.size() > views) { key = _keys.remove(0); Object oldView = _serializedViews.remove(key); if (oldView != null) { getOldSerializedViewsMap().put(key, oldView); } } } The second while loop is trimming the "strong-referenced" pool down to the necessary size, and adding the removed entries into the weak pool. So just commenting out the call to getOldSerializedViewsMap().put(key, oldView); should do the trick. Regards, Simon

