Christoph Zwerschke wrote on 1/27/08 2:38 AM:
> Christoph Zwerschke schrieb:
>   
>> Ben Parker wrote:
>>     
>>> Calls to forward() will invoke the complete awake/respond/sleep cycle 
>>> within the outer awake/respond/sleep cycle of the parent transaction. 
>>> This means that if a servlet forwards a request to another servlet, then 
>>> the session will be awakened twice and put to sleep twice (or more 
>>> depending on the number of forward calls). This was causing some issues 
>>> in our application because we use database sessions, but it would apply 
>>> to anyone using the SessionFileStore as well.
>>>       
>> the transaction actually awake()s the session only if it does not exist, 
>> so it should not happen twice. Can you check that again? But I think 
>> you're right about sleep(). Transaction.awake() should really increase a 
>> counter if it does not awake the session because it already exists, and 
>> Transaction.sleep() should decrease the counter and send the session to 
>> sleep if it reaches zero. Would this solve your problem?
>>     
>
> I wrote nonsense in my first sentence. Of course the session is only 
> awakened if it *exists*, i.e. when it was set with setSession() or 
> implicitly created with session(). So you're right, in a nested 
> transaction it will be awakened twice.
>
> I have now solved this in with a counter as you suggested:
> http://svn.w4py.org/Webware/trunk/WebKit/Transaction.py
>
> Let me know if this solves your problem. It will then go into Ww 1.0.
>   
That looks good to me. I put the counter in our custom Session subclass, 
but having it in the Transaction should be the same result.

Sorry I didn't respond sooner to your original email. I was away over 
the new year and this totally fell off my radar.

Thanks! Ben

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to