"ALRubinger" wrote : 
  | ...if you set stuff in a ThreadLocal, ensure that its removed if the Thread 
has been obtained from a Thread pool.  Otherwise, nightmares.
  | 

Thanks ALR, I'll watch out for that

"ALRubinger" wrote : 
  | Or in your case...if you don't want to put any JPA stuff in your DAO 
APIs...why not just pass the EM into the DAOImpl Constructor?
  | 

DAOImpls are currently singleton per DAO iface, but must be thread safe, so I'm 
using ThreadLocal rather than passing in via method parameters.

I could stop using a singleton and create a DAOImpl per DAO request (as you 
suggest), but then I have a proliferation of DAOs just to ensure thread safety 
which smells of an antipattern. 

Thank you for your comments everyone.

C

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984828#3984828

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984828
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to