Re: [Webware-discuss] forward() and Session mgmt

2008-01-29 Thread Ben Parker

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/vse012070mrt/direct/01/
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


Re: [Webware-discuss] forward() and Session mgmt

2008-01-27 Thread Christoph Zwerschke
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.

-- Chris

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


Re: [Webware-discuss] forward() and Session mgmt

2007-12-18 Thread Christoph Zwerschke
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.

Hi Ben,

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?

-- Chris

-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


Re: [Webware-discuss] forward() and Session mgmt

2007-12-17 Thread Chuck Esterbrook
On Dec 17, 2007 12:31 PM, Ben Parker [EMAIL PROTECTED] wrote:
 Hey all -

 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
...
 Has anyone else encountered this? Do you think it's an issue to be
 handled within Webware or left up to the application developer?

The current behavior hasn't caused problems for me, but I can
certainly see how it could as you describe above. My opinion is that
your solution should be inside Webware because eventually others will
have the same problem and its doubtful that anyone needs the redundant
calls. Also, we could offer a setting or at least a class level
variable somewhere to turn it off.

-Chuck

-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss