Re: WO instance locks up and won't die - part 2
Re: WO instance locks up and won't die - part 2
- Subject: Re: WO instance locks up and won't die - part 2
- From: Chuck Hill <email@hidden>
- Date: Thu, 20 Nov 2003 20:31:44 -0800
At 08:05 AM 21/11/2003 +1300, Denis Stanton wrote:
>>>>
<continued>
No, I'm not locking any EC. I use only
session().defaultEditingContext, except in the Direct Actions.
You really ought to lock them in direct actions too, but if you create one
per call to a direct action that is not the cause of the deadlock (if, in
fact, that is what is happening). It is sounding more like a session is
not getting checked back in due to an exception. Have you overridden
handle... in Application?
I haven't overridden anything in Application as far as I recall.
So the users just see the standard WO page when they get an exception?
If so, make sure that each one can NOT throw an
exception. WO really does not like that:
public WOResponse handleException(Exception anException,
WOContext aContext) {
try {
// your exception handling code here
} catch (Throwable t) {
// We're in deep trouble here, see if super can help
try {
return super.handleException(anException, aContext);
} catch (Throwable t) {
// OK, this is really not good, suicide time
Runtime.getRuntime().exit(1);
}
}
}
I'm not sure what the above code will do. Are you recommending I add this
to Application?
If you handle exceptions in Application you ought to ensure the handling
method cannot throw. WO is expecting it to handle exceptions, not produce
them. The above code is one example of doing this. Throwing an exception
from handleException can produce a deadlocked session, at least it did once
upon a version.
My application code reads as below.
public class Application extends WOApplication {
public static void main(String argv[]) {
WOApplication.main(argv, Application.class);
}
public Application() {
super();
System.out.println("Welcome to " + this.name() + "!");
System.out.println(" SMTPHost = " + this.SMTPHost());
/* ** Put your application initialization code here ** */
setAllowsConcurrentRequestHandling(true);
}
public WOResponse handleSessionRestorationErrorInContext(WOContext
context){
Main nextPage = (Main)pageWithName("Main",context);
// nextPage.doOrShowSomethingBecauseSessionTimedOut();
//display message to user, etc...
WOResponse response = nextPage.generateResponse();
if(response == null){
response = super.handleSessionRestorationErrorInContext(context);
}
return response;
// return nextPage;
}
}
Better as:
public WOResponse handleSessionRestorationErrorInContext(WOContext
context){
try {
Main nextPage = (Main)pageWithName("Main",context);
WOResponse response = nextPage.generateResponse();
if(response == null){ // Can this happen?!!?
response =
super.handleSessionRestorationErrorInContext(context);
}
return response;
} catch (Throwable t) {
return super.handleSessionRestorationErrorInContext(context);
}
}
Or just:
public WOResponse handleSessionRestorationErrorInContext(WOContext
context){
try {
Main nextPage = (Main)pageWithName("Main",context);
return nextPage.generateResponse();
} catch (Throwable t) {
return super.handleSessionRestorationErrorInContext(context);
}
}
<<<<
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
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.