Hi Chuck,

could you elaborate more on the shared formatters thing?

> Don't Do Stupid Things  :-)  Which boils down to don't share objects that are 
> not thread-safe, or writable data, at the global level unless you have 
> appropriate protection.  Global being either static members or instance 
> variables on your application.  Shared, non-thread safe formatters are a 
> common mistake.

we inherited a project that has random (but infrequent) lockups and I found 
that in the Application.java

first there is an instance variable

private NSNumberFormatter millionsFormatter;

then a lazy initialization in the accessor method:

public NSNumberFormatter millionsFormatter() {
  if (millionsFormatter ==null) {
    millionsFormatter = new NSNumberFormatter();
    millionsFormatter.setPattern("###,##0.00");
    millionsFormatter.setDecimalSeparator(",");
    millionsFormatter.setThousandSeparator(".");
  }
  return  millionsFormatter;
}

Could this approach be one of the causes of the lockups? The app runs in 
multithreaded mode and there are tons of components with WOStrings bound to 
this formatter...

Thanks,


Matteo

 _______________________________________________
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]

Reply via email to