wood burning stoves 2.0*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "About Singletons." Watch "About Singletons." New topic

About Singletons.

Nitin Menon
Ranch Hand

Joined: Jun 13, 2007
Posts: 79
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.
subject: About Singletons.
Similar Threads
How to test singleton creation with JUnit
Parameters VS Singleton
cleared 1Z0-895 with 98%
Static vs Single Pattern
Wikileaks announced that they will re-release source code for thousands of Open Source Java projects