Candidates for use of Singleton Pattern

Hi

Can any guide me , where to use Single Design pattern in Java Based Applications

Should i use Singleton Pattern in the following situations

1)RMI Server

2)Controller Classes ( MVC) invoked by Servlet

3)Database cashing /handling classes

Please suggest other suitable places also

Thanks in Advance

[363 byte] By [PatneyS] at [2007-9-26 16:32:03]
# 1

Hii

Typical uses of a singleton pattern are in those cases where you have to have a single instance of a class.For example if u have an RMI based application and the client needs to perform a RMI lookup(for the URL etc)in that case for a particular user you wud like to have just a single instance for the lookup.

In case of controller classes invoked by the servlet you would typically not want a Singleton as multiple instances of the servlet might require to use a controller object.As the request parameters would be different for each servlet instance,you would need a controller object for each of them.

maneesh2677 at 2007-7-2 20:13:00 > top of Java-index,Other Topics,Patterns & OO Design...