Regsrding the use of singleton method in our assignment.....
Devu Shah
Ranch Hand
Joined: Jun 21, 2001
Posts: 50
posted
0
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
posted
0
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.....