I am doing jndi lookup for datasource configured in JBOSS AS.Code for which is as below.
initialContext = new InitialContext(props);
dataSource = (DataSource)initialContext.lookup(bundle.getString("jndiName"));
connection = dataSource.getConnection();
This snippet of code is placed in doPost of servlet. Also i am safely calling
connection.close()
after using connection object.
My datasource config has following entries
<min-pool-size>1</min-pool-size>
<max-pool-size>1</max-pool-size>
As per my understanding of connection pooling, each time i make a request to servlet same connection object is returned by datasource .getConnection()
call(Since i have specified min and max pool size to be 1 and a call to close does not close the DB connection altogether).
Now how do i verify that same connection object is being returned?