Fist of all, do NOT top post. Use the power of your wondeful mail client.
Am 2013-04-05 13:05, schrieb Jean-Claude Haw-King-Chon:
I wish to avoid passing the connection through the layers of the application (from controller to DAO). The controller initialize the connection and must pass it to the Dao layer. I don't want to pass the datasource or connection to the business layer as a parameter. Futher, the data source can be different for each user : it's not possible to use a static attribute to store the connection or the datasource (by example, in a connection factory). That's why I think that "threadlocal" is the solution for passing the connection between 2 non adjacent layers : is it a bad practice?
ThreadLocals have their use cases but must be used with great caution. Are you certain that no one else sets the ThreadLocal and you do not suffer from race conditions due to missing synchronization?
Michael --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org