wood burning stoves 2.0*
The moose likes Spring and the fly likes Question on Singleton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Question on Singleton" Watch "Question on Singleton" New topic
Author

Question on Singleton

Rahul Sud
Greenhorn

Joined: May 27, 2008
Posts: 25
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

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

"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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on Singleton