On Dec 17, 2007 12:31 PM, Ben Parker <ben@...> 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

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
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 issue is that the session is saved after every forward call, and
might not be in an appropriate state to start another transaction, but
another request can come in before the parent transaction puts the
session to sleep for the final time (e.g. user with two browsers open,
or double-clicking, etc). I have handled this in our application by
keeping an "awakened" count on the session object, and ensuring that the
session is only put to sleep when the awakened count is 0, e.g. when the
final sleep() has been called.
It would be pretty straightforward to integrate the awakened count into
Webware's default session management options, but that would be changing
functionality. I can't see how anyone would be relying on the current
behavior, but you never know ...
Has anyone else encountered this? Do you think it's an issue to be
handled within Webware or left up to the application developer?
Regards - Ben

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details