Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in getting connection from datasource for multiple threads

 
varsha rao
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

We are using a multi threaded approach wherein we are tyring to get connection from the datasource.

But the problem is when all the 12 threads try to get the conncetion at the same time from the datasource, the code is getting hanged. No exception is thrown . How do we solve this?

Is getting connections from a datasource advisable for a multi threaded approach or is there any better alternative?

Please suggest
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is getting connections from a datasource advisable for a multi threaded approach or is there any better alternative?


Yes. The normal approach would be to use a connection pool.
 
varsha rao
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks but i have another doubt. On what factors should i decide the value of the maxActive and initialSize parameters for my application . Could you suggest on this. Our application can have at a time a max of 200 users logged on to it.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not easy to suggest this without knowing more about your application. I suggest you do some performance tests on your app, see if a figure presents itself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic