Re: HowTo cleanup Session data after an Application error occurred
Re: HowTo cleanup Session data after an Application error occurred
- Subject: Re: HowTo cleanup Session data after an Application error occurred
- From: Jonathan Rochkind <email@hidden>
- Date: Wed, 10 Sep 2003 16:39:30 -0500
terminate() should be called whenever a Session ceases to exist. The two
ways (I can think of) for a Session to cease to exist are:
1) The session time's out
2) Someone manually calls terminate()
[Actually, there's a 3: The whole App instance ceases to exist. terminate()
is NOT called in this case. We can discuss that further if that's a concern].
I'm not sure what you mean by the session 'crashes'. A session is an
object. What exactly happens when the session 'crashes'? If the session no
longer exists, but terminate() was not called, that's a WO bug. [And I'd
be curious what conditions it exhibits in! ]. If the session does still
exist---then of course terminate() has not been called. But eventually the
session will time out---and at that point, terminate() will be called. If
the session DOES still exist, but does NOT ever time out, that's a WO bug
too (and again I'd be curious exactly what's going on; it seems an unlikely
bug to me].
So I'm a bit confused about your situation.
When an exception is reported with the WO exception page, this does not
mean that the _session_ has "crashed". It just means that an exception was
reported to the user. The session still exists, there are various URLs
pointing in to that session which are still valid, and the session will
keep on existing until it times out---at which point terminate() will be
called. In general, Application.handleException() is your hook into
uncaught exceptions that, by default, are displayed to the user with the WO
exception page. If you WANT the session to end whenever handleException is
called---well, you can just override Application.handleException to
manually call terminate() on the relevant session in this case.
[Note that the default WO exception page has some links, and these links
_are_ component actions, which require a session, so if you terminate the
session these links may not work. You may want to provide your own
exception page which has only direct action links, or non-WO URLs, so that
it will keep working even though the session is terminated. Note that the
WO exception page source is provided to you, so you can easily modify
it. Or you may want to try to terminate the session, but then provide the
WO exception page in a _new_ session. That would be tricky, but should be
possible somehow. .]
Hope this helps,
--Jonathan
At 10:09 PM 9/10/2003 +0200, Helmut Tschemernjak wrote:
Hello,
within a session I store a TCP/IP socket connection for my private
communication to another server. When the session crashes and WO reports
the very helpful error stack backtrace. I need a way to close the socket
connection which is stored in the session object.
My understanding is that the thread will be stopped, but I need to close
my private socket to avoid hanging dead connections.
I have a implemented a terminate function which gets called for a session
timeout but terminate is not getting called on errors.
Any ideas?
best regards / mit freundlichen Gruessen,
Helmut Tschemernjak
HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Phone: +49-5131-709320
Fax: +49-5131-709325
Internet Mail: email@hidden
Internet Web: http://www.helios.de
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.