• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Concurrent request handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Concurrent request handling


  • Subject: Re: Concurrent request handling
  • From: Dev WO <email@hidden>
  • Date: Thu, 07 Apr 2011 09:00:47 +0200

Hello Chuck,

Sorry to jump into this to add another question:)
But I would have expected the formatter to not be an issue as it's not actually writing data.
If you have a stateless app (like full of DA), how would you handle that as you can actually put the formatter in Session?
Do you have to put the formatter inside the EO class?

Thanks,

Xavier


On 5 avr. 2011, at 20:17, Chuck Hill wrote:

Hi Matteo,

I don't think that will cause a deadlock.  It will cause some incorrectly formatted input / output.  The easiest fix is to move this from Application to Session and adjust the bindings.

As for the lockups, you really need to get thread dumps to assess those.  jstack is an easy way to do this.


Chuck


On Apr 5, 2011, at 11:12 AM, Matteo Centro wrote:

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


-- 
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/products/practical_webobjects






Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Concurrent request handling
      • From: Andrew Lindesay <email@hidden>
References: 
 >Concurrent request handling (From: Mark Wardle <email@hidden>)
 >Re: Concurrent request handling (From: Chuck Hill <email@hidden>)
 >Re: Concurrent request handling (From: Matteo Centro <email@hidden>)
 >Re: Concurrent request handling (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Newbie question
  • Next by Date: Re: D2W master-detail handling question
  • Previous by thread: Re: Concurrent request handling
  • Next by thread: Re: Concurrent request handling
  • Index(es):
    • Date
    • Thread