DAO 's factory is right or not! URGENT 2004-07-15 - By Manish Malhotra
Back Im again sending this query because no body has replied yet. I need some help as early as possible.
Manish
Hi All,
We have implemented the Data Access Object pattern to access the interact with data base. And to get the different DAO objects we used DAO factory. Code snippet is like this:
public class CentralOverrideDAOFactory { /** Map to store object of different DAO's*/ private static Map daoMap = Collections.synchronizedMap(new HashMap());
/** final constant for bank */ private static final String BANK = "BANK";
/** * This method returns the instance of BankOverrideDAO class from cached map. * If it is not available in map then it creates new instance and returens it. * * @(protected) BankOverrideDAO */ public static BankOverrideDAO getBankOverrideDAO() { BankOverrideDAO bankDAO = (BankOverrideDAO)daoMap.get(BANK); if(bankDAO == null) { bankDAO = new BankOverrideDAO(); daoMap.put(BANK, bankDAO); } return bankDAO; }
}
So, my issue is that we are marinating cache of DAO objects in the factory. And using the same object for multiple request.
Our scenario is like this:
So, please give your suggestions regarding the performance issue.
Thanks in advance.
regards, Manish Malhotra
=========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
|
|