• 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

Question on Singleton

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Techies,

We know that Spring is by default singleton.
Now the question is How it will behave when more than two request comes at same time on the same method.How that will be handled in the by Spring.
I suppose same instance will be shared but what is the normal approach to handle that.I mean the JVM behavior for this also.

Thanks,
Rahul

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"How to handle it" depends on what it's actually doing. If there's no shared state and you're just calling methods with only parameters and local variables, there's nothing to do. If you're reading shared state that might change, or mutating shared state, something somewhere along the line would need to be synchronized, whether it's a simple collection, and entire method, etc. Totally depends.
reply
    Bookmark Topic Watch Topic
  • New Topic