This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When does JBoss create the connection pool?

 
Binoj Bhaskaran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to host a service on a JBoss. After starting the Jboss the first request to the service is always slow, and this seems to be because the getConnection call is taking time.

dataSource = ServiceLocator.getInstance().getDataSource(dsName);
connection = dataSource.getConnection();

Subsequent requests are quick. Is there anyway I can configure JBoss to create the connection pool as soon as it start up?

Thanks,
Binoj
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of JBoss AS?

JBoss AS lazy-loads database connections. It will not make any connection until it receives the first connection request. When it receives one, it will establish min-connections before providing one in response to the request.
The typical answer to this is to write a startup MBean and have it request a database connection, then the time to establish the connections will become part of the AS startup time.
http://www.coderanch.com/t/90327/JBoss/Configuring-Startup-class
 
Binoj Bhaskaran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peter ! Am using JBOSS AS 4.0.4. I'll try setting up a start up bean and see how it goes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic