• Post Reply Bookmark Topic Watch Topic
  • New Topic

struts and threads  RSS feed

 
Larry Jones
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have a struts webapp that in the action class method execute, it calls a class such as NumberFormat.aMethod. Do I have to worry about synchronizing and concurrency?
 
Atul Prabhu
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Calling methods on NumberFormat.*** dont need synchronisation as those methods dont share your resources.

Could you be more specific ?

Regards
Atul
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NumberFormat objects are not threadsafe. If you need to use a specific instance of NumberFormat, create a new one for each thread (as a local variable in your method somewhere, not an instance variable).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!