This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
While discussing about ServletContextListener, HFSJSP 2e says that it is used for initializing a DataSource. Is this a good approach? I've seen the DataSource objects are handled by the container itself. What is the best way?
My take on this is that it's a good way to do it because the datasource lookup only happens once. I've seen other code where the lookup happens over and over again which is a waste of resources. I've tried different ways of doing it and based on feedback that I received here, this is the context listener that I now use.
This is the DataSourceHolder class:
Suggestions for improving this are welcome.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson