tearDown();
}
+ public void testPoolThreads10Connections10Fair() throws Exception {
+ init();
+ this.datasource.getPoolProperties().setMaxActive(10);
+ this.datasource.getPoolProperties().setFairQueue(true);
+ this.threadcount = 10;
+ this.transferProperties();
+ this.datasource.getConnection().close();
+ latch = new CountDownLatch(threadcount);
+ long start = System.currentTimeMillis();
+ for (int i=0; i<threadcount; i++) {
+ TestThread t = new TestThread();
+ t.setName("tomcat-pool-"+i);
+ t.d = this.datasource;
+ t.start();
+ }
+ latch.await();
+ long delta = System.currentTimeMillis() - start;
+ System.out.println("[testPoolThreads10Connections10Fair]Test complete:"+delta+" ms. Iterations:"+(threadcount*this.iterations));
+ tearDown();
+ }
+
public void testC3P0Threads10Connections10() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
this.datasource.getPoolProperties().setMaxActive(10);
this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
this.datasource.getPoolProperties().setTestOnBorrow(true);
+ this.datasource.getPoolProperties().setFairQueue(false);
this.threadcount = 10;
this.transferProperties();
this.datasource.getConnection().close();
tearDown();
}
+ public void testPoolThreads10Connections10ValidateFair() throws Exception {
+ init();
+ this.datasource.getPoolProperties().setMaxActive(10);
+ this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
+ this.datasource.getPoolProperties().setTestOnBorrow(true);
+ this.datasource.getPoolProperties().setFairQueue(true);
+ this.threadcount = 10;
+ this.transferProperties();
+ this.datasource.getConnection().close();
+ latch = new CountDownLatch(threadcount);
+ long start = System.currentTimeMillis();
+ for (int i=0; i<threadcount; i++) {
+ TestThread t = new TestThread();
+ t.setName("tomcat-pool-validate-"+i);
+ t.d = this.datasource;
+ t.start();
+ }
+ latch.await();
+ long delta = System.currentTimeMillis() - start;
+ System.out.println("[testPoolThreads10Connections10ValidateFair]Test complete:"+delta+" ms. Iterations:"+(threadcount*this.iterations));
+ tearDown();
+ }
+
public void testC3P0Threads10Connections10Validate() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
this.datasource.getPoolProperties().setMaxActive(10);
this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
this.datasource.getPoolProperties().setTestOnBorrow(true);
+ this.datasource.getPoolProperties().setFairQueue(false);
this.threadcount = 20;
this.transferProperties();
this.datasource.getConnection().close();
tearDown();
}
+ public void testPoolThreads10Connections20ValidateFair() throws Exception {
+ init();
+ this.datasource.getPoolProperties().setMaxActive(10);
+ this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
+ this.datasource.getPoolProperties().setTestOnBorrow(true);
+ this.datasource.getPoolProperties().setFairQueue(true);
+ this.threadcount = 20;
+ this.transferProperties();
+ this.datasource.getConnection().close();
+ latch = new CountDownLatch(threadcount);
+ long start = System.currentTimeMillis();
+ for (int i=0; i<threadcount; i++) {
+ TestThread t = new TestThread();
+ t.setName("tomcat-pool-validate-"+i);
+ t.d = this.datasource;
+ t.start();
+ }
+ latch.await();
+ long delta = System.currentTimeMillis() - start;
+ System.out.println("[testPoolThreads20Connections10ValidateFair]Test complete:"+delta+" ms. Iterations:"+(threadcount*this.iterations));
+ tearDown();
+ }
+
public void testC3P0Threads10Connections20Validate() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);