Re: Question about Session
Re: Question about Session
- Subject: Re: Question about Session
- From: Pierre Bernard <email@hidden>
- Date: Thu, 7 Dec 2006 22:59:30 +0100
Are you holding onto an EO that was created within the default
editing context?
E.g. are you assigning the User or Currency objects to a variable
within your application class, or to a static variable?
Pierre
On 7 Dec 2006, at 18:45, Chuck Hill wrote:
On Dec 7, 2006, at 8:40 AM, Daniele Corti wrote:
well, I'm quite sure that it's the same and that it's called
Session.terminate():
When I wrote the first code, I thought it would be better to
forget all the objects in the ec, to reinizialize the ec with the
session so in the Session.java I've overwritten public void
terminate()
public void _cleanUp()
{
this.setUser(null);
this.setDisplayCurrency(null);
_needsLogin = true;
this.defaultEditingContext ().revert();
}
public void terminate()
{
//NP: make sure we clean up
this._cleanUp();
this.defaultEditingContext().reset(); // forget all our objects
super.terminate ();
}
If either of these methods throw an exception, the session will not
terminate.
Neither of those methods do anything that is necessary.
Have you added logging to see that terminate() gets called when you
expect it to?
well when the session timed out and I reenter in the app,
With the same session ID?
and I try to read one of the objects, it comes out an error with
the explanation cannot read an object that is not registrated in
any editing context.
That sounds like the session did not terminate. Try adding logging
in the session constructor and in terminate to log out sessionID()
so that you can track when they die and when they are created.
I've tried to force the disposing and the reinitializations (I
don't know if that word exist...)
public void terminate()
{
//NP: make sure we clean up
this._cleanUp();
this.defaultEditingContext ().dispose(); // delete it
super.terminate();
}
well, when my session timed out and I reenter, the error is cannot
read an object that was in a editing context that was disposed
(I'm sorry if the error text is not exact but the meaning is that)
I think this means that the session terminates, or not?
Thank you, Chuck, probably you are saving my life!!!
That may be overstating it a bit! ;-)
Chuck
2006/12/7, Chuck Hill < email@hidden>: One of these
things is true:
- you think it is the same EC, but it is not
- the session did not terminate
What makes you think it is the same EC?
Chuck
On Dec 7, 2006, at 8:09 AM, Daniele Corti wrote:
> Hi all,
> I'm a little cofused: in my app I use as editing context the
> Session.defaultEditingContext(), and I thought that when the
> session is terminated automatically the ec would be disposed. well,
> today I've notice that when the session timed out, and I reenter in
> the app, when the session is created the defaulEditingContext()
> still points to the old ec.
>
> Am I the only one that found this a little strage?
>
> --
> Daniele Corti
> AIM: S0CR4TE5
> Messenger: email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
--
Daniele Corti
AIM: S0CR4TE5
Messenger: email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
- - -
Houdah Software s. à r. l.
http://www.houdah.com
- Quality Mac OS X software
- Premium WebObjects consulting
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden