GeeCON Prague 2014*
The moose likes JBoss/WildFly and the fly likes When does JBoss create the connection pool? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "When does JBoss create the connection pool?" Watch "When does JBoss create the connection pool?" New topic
Author

When does JBoss create the connection pool?

Binoj Bhaskaran
Greenhorn

Joined: Jan 20, 2012
Posts: 2
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

Joined: May 14, 2008
Posts: 5836
    
    7

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


JBoss In Action
Binoj Bhaskaran
Greenhorn

Joined: Jan 20, 2012
Posts: 2
Thanks Peter ! Am using JBOSS AS 4.0.4. I'll try setting up a start up bean and see how it goes.
 
GeeCON Prague 2014
 
subject: When does JBoss create the connection pool?