Thanks,
Shailesh
Mark Wa wrote:I meant in the context of will it cause problems with sessions, for example, if i have 2 users using the system at the same time, they will get one singleton between them? and not one each.
vignesh dhakshinamoorthy wrote:Hi, i am using singleton pattern in my web application.
Whether it is right or wrong, I am using it to preserve the JDBC Connection object.
Reason:
O I am hitting the database umpteenth times.
O Every time, i cannot create a Connection object to hit the DB.
O So i will create that Singleton once the user logs in.
And someone please tell me if i am following a 'wise' approach ?
If not, please do suggest the best approach![]()
Mark Wa wrote:I meant in the context of will it cause problems with sessions, for example, if i have 2 users using the system at the same time, they will get one singleton between them? and not one each.
Paul Sturrock wrote:
Personally I wouldn't do this. Its far easier to just use a ConnectionPool. What you are doing sounds like a (missguided) early optimisation
Don't get me started about those stupid light bulbs. |