Java Singleton Pattern ( One Of Creational Patterns ) icin:
1) Bir class'in icinde Private Static Object
2) Private Constructor
3) Static get Instance Method of the object
4) Change getInstance Method to synchronized for threadsafe
5) Override clone method of Object, and do
throw new CloneNotSupportedException()
6) Optional, making the class final to not override
No comments:
Post a Comment