Java : Singleton class instances in a Web based Application
- by Preethi Jain
I have this Singleton class inside a Web Application .
public class MyDAO
{
private static MyDAO instance;
private MyDAO() {
}
public static MyDAO getInstance() {
if (instance == null) {
instance = new MyDAO();
}
return instance;
}
I will access it this way
public void get_Data()
{
MyDAO dao = MyDAO.getInstance();
}
How many Objects of MyDAO class will be created if there are 3 Users accessing the Application ??
Will there be one instance of MyDAO per User ??