It's all thread safe, including getDao(Class). Each instance will be thread
safe as well.
Clinton
On Mon, Jun 23, 2008 at 4:48 PM, mfs <[EMAIL PROTECTED]> wrote:
>
> Guys,
>
> I am using ibatis DAO Framework and i had certain questions/concerns, that
> whether my current DAO Manager implementation is thread safe, since
> apparently the getDAO(MyDAOClass.class) method (which i am using to
> retrieve
> the dao implementation) isn't thread safe. Also Larry mentioned in one some
> other thread that there is one instance maintained of each DAO
> implementation and thats yet another reason which made to me ask this...
>
> class MyDAOManager
> {
> private static DaoManager s_daoManager;
>
> public static synchronized DaoManager getDaoManager()
> {
> Log log = LogFactory.getLog(DAOManager.class);
> if (null == s_daoManager)
> {
> try
> {
> String daoXMLresource = "[path]/dao.xml";
> Reader reader = Resources.getResourceAsReader(daoXMLresource);
> s_daoManager = DaoManagerBuilder.buildDaoManager(reader);
> log.info("DAOManager Initialized");
> }
> catch (IOException ioe)
> {
> throw new RuntimeException("Could not initialize DaoConfig.
> Cause: " + ioe);
> }
> }
> return s_daoManager;
> }
>
> public static AccountDAO getAccountDao()
> {
> return (AccountDAO) getDaoManager().getDao(AccountDAO.class);
> }
>
> public static UserDAO getUserDao(Class interfaceClass)
> {
> return (UserDAO) getDaoManager().getDao(UserDAO.class);
> }
>
> Thanks and Regards,
>
>
>
> --
> View this message in context:
> http://www.nabble.com/DAO-Framework---question-on-thread-safety-tp18080103p18080103.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>