Hi,
I have several WebObjects 5.3.2 applications deployed in production
running with Java 5, and I've found something worrying with stateless
components. By the way, these applications are set to allow
concurrent request.
I have an heavily used stateless component managing is own bindings
synchronisation:
public class Cell extends WOComponent {
// Private instance variable
private Boolean _flag;
// Code removed for clarity...
[...]
public boolean flag() {
if(_flag == null) {
// Initialize _flag to a Boolean instance: it can't be
set to null
[...]
}
return _flag.booleanValue();
}
public boolean isStateless() { return true; }
public void reset() {
super.reset();
// The only place in the variable is set to null
_flag = null;
}
public boolean synchronizesVariablesWithBindings() { return false; }
}
But sometimes (less than 1% of concurrent requests), I get a
NullPointerException on the "return _flag.booleanValue();" line! And
this is only an evidence of the problem: sometimes I also get
incorrect values. Normally, this can't be the case according to the
WOComponent documentation:
<< Note that a stateless component's instance variables will remain
valid for the duration of the phase (takeValuesFromRequest ,
invokeAction , appendToResponse ); this lets you use instance
variables in the stateless components to hold things analogous to
items in a WORepetition. >>
And IIRC, WebObjects use only one instance of a stateless component
per thread. So I must conclude another thread called "reset()" on the
same component instance, violating the WOComponent contract quoted
above. This seems to be a bug in WebObjects... Can someone confirm
this? Is their any workaround? I've tried to syncronize the stateless
component in the appendToResponse method, but it leads to deadlocks
on concurrent requests...
Kind regards,
--
Francis Labrie
Saint-Bruno-de-Montarville, Quebec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to archive@mail-archive.com