• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Method calls synchronization in Tomcat

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,
Does anyone know if I can use methods of an instance of a class for processing simultaneous requests? If there is only one instance of such a class per web application, then should all methods (called by servlet serving a request) be declared as synchronized, or synchronization will be done automatically by the servlet? I think it should be done automatically, but I am not sure.
Thanks for help!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. Synchronization will NOT be done automatically by the servlet.
. Should all methods be declared as synchronized? It depends. If the method only uses local variables, no synchronization is needed. If the method accesses the instance/class variables, you usually should synchronize it. (Assuming you are not using SingleThreadModel)
[ August 21, 2003: Message edited by: Yong Chen ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic