aspose file tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Regsrding the use of singleton method in our assignment..... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "Regsrding the use of singleton method in our assignment....." Watch "Regsrding the use of singleton method in our assignment....." New topic
Author

Regsrding the use of singleton method in our assignment.....

Devu Shah
Ranch Hand

Joined: Jun 21, 2001
Posts: 50
hi everybody,
i have one confusing question.
I know what is an Singleton pattern.
But I want to know where do we implement it in our assignment.?
If we are not using it what difference does it make in the apllication working.
(Why i am asking... is because, already methods are syncronised and also we all are implementing lock-unlock mechnism ...then what would be specieal function of Singleton? )
Please explain me if i am wrong some where.
Rick Fortier
Ranch Hand

Joined: Jun 04, 2001
Posts: 147
The singleton pattern is when you want to make sure that you only have one copy of something. So if you are trying to maintain a list of current locks on the database, then that would be a good place to use it. You dont want each thread to create its own copy of the locks do you?
Then you must synchronize the collection you are using. I used as HashMap to keep the list of current locks.
locks = Collections.synchronizedMap(new HashMap());
 
 
subject: Regsrding the use of singleton method in our assignment.....
 
Threads others viewed
Data access class desing
Java Scrolling Applet Using Arrays Help please
java(intermediate)
Cache in Data Class
Singleton vs static methods
MyEclipse, The Clear Choice