Hello everybody,
I've been JAD-ing around WOSession and WOApplication out of
curiousity and bumped into this inner for WOApplication class:
protected class TimeoutTask extends TimerTask {
protected TimeoutTask() {
super();
}
public void start() {
applicationTimer().schedule(this, (long)(timeOut() *
1000D));
}
public void run() {
long inactivity = System.currentTimeMillis() -
WOApplication._TheLastApplicationAccessTime;
if((double)inactivity >= timeOut())
terminate();
else
applicationTimer().schedule(this, (long)(timeOut() *
1000D) - inactivity); (*)
}
public boolean cancel() {
return super.cancel();
}
}
Looking at the (*) bolded line in the else block I couldn't help
spotting that an attempt to reuse both the timer, which is usually OK,
and the TimerTask? Now, this shouldn't be possible according to the
JDK docs, so I've tried it and of course got the expected
"Exception in thread "Timer-0" java.lang.IllegalStateException: Task
already scheduled or cancelled"
error.
Another thing is the checked condition in the if statement -
comparing milliseconds to seconds, since inactivity holds the
milliseconds since last application access time, and timeOut() returns
the time out in seconds, which is kind of explaining why the else
block is usually skipped.
It might be a very stupid and obvious thing, but I'd appreciate if
anyone can explain to me why (*) would work for WO and not for me?
Cheers,
Bogdan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]