//we didn't get a connection, lets see if we timed out
if (con == null) {
if ((System.currentTimeMillis() - now) >= maxWait) {
- throw new SQLException(
- "Pool empty. Unable to fetch a connection in " + (maxWait / 1000) +
+ throw new SQLException("[" + Thread.currentThread().getName()+"] " +
+ "Timeout: Pool empty. Unable to fetch a connection in " + (maxWait / 1000) +
" seconds, none available["+busy.size()+" in use].");
} else {
//no timeout, lets try again
}
public void testDBCPThreads20Connections10() throws Exception {
+ System.out.println("Starting fairness - DBCP");
init();
this.datasource.getPoolProperties().setMaxActive(10);
this.threadcount = 20;
this.run = false;
long delta = System.currentTimeMillis() - start;
printThreadResults(threads,"testDBCPThreads20Connections10");
+ System.out.println("Completed fairness - DBCP");
tearDown();
}
public void testPoolThreads20Connections10() throws Exception {
+ System.out.println("Starting fairness - Tomcat JDBC - Non Fair");
init();
this.datasource.getPoolProperties().setMaxActive(10);
this.threadcount = 20;
this.run = false;
long delta = System.currentTimeMillis() - start;
printThreadResults(threads,"testPoolThreads20Connections10");
+ System.out.println("Completed fairness - Tomcat JDBC - Non Fair");
tearDown();
}
public void testPoolThreads20Connections10Fair() throws Exception {
+ System.out.println("Starting fairness - Tomcat JDBC - Fair");
init();
this.datasource.getPoolProperties().setMaxActive(10);
this.datasource.getPoolProperties().setFairQueue(true);
this.run = false;
long delta = System.currentTimeMillis() - start;
printThreadResults(threads,"testPoolThreads20Connections10Fair");
+ System.out.println("Completed fairness - Tomcat JDBC - Fair");
tearDown();
}