• Post Reply Bookmark Topic Watch Topic
  • New Topic

How many ways to break Singleton in Java?  RSS feed

 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Please can anyone tell me , how many ways to break singleton in Java?

Regards,,
Prabhat
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by 'break singleton' ?
 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, i mean singleton is basically used not to create multiple instance of the class.

but is there any way to create multiple instance lets say cloning() or any another..

 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prabhat Ranjan wrote:Yes, i mean singleton is basically used not to create multiple instance of the class.

but is there any way to create multiple instance lets say cloning() or any another..


Well, if the singleton is created correctly, then you should not be able to create more than one instance.

If you can, then there is a bug, and depending on the bug, I guess there could be countless ways to break it.

Henry
 
Paul Clapham
Sheriff
Posts: 22834
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe what you are missing is this: "singleton" is simply a description, or definition. But you seem to be asking about actual implementations, or attempted implementations, of that definition, without giving any examples of those attempted implementations.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!