• Post Reply Bookmark Topic Watch Topic
  • New Topic

Storing SQL DataSource in ServletContext  RSS feed

Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know what can be the consequences of storing the javax.sql.DataSource reference in the ServletContext i.e application scope. I have seen some code where ServletContextListener is implemented and in contextInitialized() method we lookup the datasource and put that in application scope.
It works well as far as I have seen but what would happen under the heavy or medium load on webapplication? Will there be race condition between different threads trying to get the datasource from the ServletContext.getAttribute().
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!