Adrian Crum wrote:
> Just a friendly reminder to the OFBiz developers and committers: The
> screen widget model classes should not have their state altered by
> renderers. That is not thread-safe and it results in undesirable behavior.
> 
> I know it's easy to forget - I just deprecated some methods that I wrote
> where I made that mistake. :-)
> 
> It might help to think of the widget model classes as being immutable
> (though technically they aren't). Once they are constructed and put in
> the cache, they shouldn't be changed.

Then why not be explicit about it?  Make the classes final(maybe),
make their fields final(required), set all such fields only in the
constructor(required).  If construction is more dynamic/complex, use a
Builder pattern.

immutable classes don't require locking, which is also a good goal to
strive for.

Reply via email to