hi all:
if DAO factory frame work is used in a multi- threaded
J2EE project, when is it appropriate to cach a single object and return it over and over again, vs. retruning a brand new object.
for example:
//cached object
public class DAOFactory
{
privte EmployeeDAO MyEmployeeDAO = new EmplyeeDAO();
public EmplyeeDAO getEmplyeeDAO();
{ return MyEmployeeDAO;}
}
vs.
//new object
public class DAOFactory
{
public EmplyeeDAO getEmpoyeeDAO()
{ return new EmplyeeDAO();}
}
I really appreciate it if someone can explain to me in what situation should I use which technique, and if there is any performance implication in using any of them.
thanks
[ April 22, 2004: Message edited by: Hanna Habashy ]