It's not a secret anymore!
The moose likes Spring and the fly likes About Singletons. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "About Singletons." Watch "About Singletons." New topic

About Singletons.

Nitin Menon
Ranch Hand

Joined: Jun 13, 2007
Posts: 87
In my application, there is a module where no more than three users should login simultaneously. It has a functionality where a PDF file is created and mailed. I had read about about singleton beans. I would love to know how singletons are processed. Also, What are their specialties and the scenarios in which they are used.
Alpesh Padra
Ranch Hand

Joined: Jan 10, 2010
Posts: 41
You can provide static int variable as member of singlton class which can increament n decrement on every login - logout.

By using singlton pattern you can restrict number of instance for class like 5, 10...

if you know then connection pooling n thread pooling concept over there . we are using same concept...

you can use same concept here.
I agree. Here's the link:
subject: About Singletons.
jQuery in Action, 3rd edition