The Artima Developer Community
Sponsored Link

Java Answers Forum
Singleton class

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
rashmi maheshwari

Posts: 9
Nickname: grashmi13
Registered: Sep, 2011

Singleton class Posted: Sep 20, 2011 10:25 PM
Reply to this message Reply
Advertisement
I have a requirement: there is a class and only 10 instances of this class can exist in application. when application tries to create 11th instance, either null or exception should generate. where ever needed in application, one instance out of 10 instances can be used.

how can i implement this requirement in my application.

can i use singleton pattern where getInstance() method create new instance till 10 times and in 11th time, it return existing instance? or singleton mean only one instance()?

should i use factory pattern in this case?

Topic: problem with form gain focus Previous Topic   Next Topic Topic: Java Classloaders

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use