throw new RejectedExecutionException("Queue capacity is full.");
}
} catch (InterruptedException x) {
- Thread.currentThread().interrupted();
+ Thread.interrupted();
throw new RejectedExecutionException(x);
}
} else {
con = pool.poll(1000, TimeUnit.MILLISECONDS);
} //while
} catch (InterruptedException ex) {
- Thread.currentThread().interrupted();
+ Thread.interrupted();
}
if (pool.size()==0 && force && pool!=busy) pool = busy;
}
proxies[i].getInterceptorClass().newInstance().poolStarted(this);
}catch (Exception x) {
log.error("Unable to inform interceptor of pool start.",x);
- if (jmxPool!=null) jmxPool.notify(jmxPool.NOTIFY_INIT, getStackTrace(x));
+ if (jmxPool!=null) jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_INIT, getStackTrace(x));
close(true);
SQLException ex = new SQLException();
ex.initCause(x);
} //for
} catch (SQLException x) {
- if (jmxPool!=null) jmxPool.notify(jmxPool.NOTIFY_INIT, getStackTrace(x));
+ if (jmxPool!=null) jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_INIT, getStackTrace(x));
close(true);
throw x;
} finally {
log.warn("Connection has been abandoned " + con + ":" + trace);
}
if (jmxPool!=null) {
- jmxPool.notify(jmxPool.NOTIFY_ABANDON, trace);
+ jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_ABANDON, trace);
}
con.abandon();
} finally {
//retrieve an existing connection
con = idle.poll(timetowait, TimeUnit.MILLISECONDS);
} catch (InterruptedException ex) {
- Thread.currentThread().interrupted();
+ Thread.interrupted();
}
if (maxWait==0 && con == null) { //no wait, return one if we have one
throw new SQLException("[" + Thread.currentThread().getName()+"] " +
this.pool = pool;
this.sleepTime = sleepTime;
if (sleepTime <= 0) {
- pool.log.warn("Database connection pool evicter thread interval is set to 0, defaulting to 30 seconds");
+ log.warn("Database connection pool evicter thread interval is set to 0, defaulting to 30 seconds");
this.sleepTime = 1000 * 30;
} else if (sleepTime < 1000) {
- pool.log.warn("Database connection pool evicter thread interval is set to lower than 1 second.");
+ log.warn("Database connection pool evicter thread interval is set to lower than 1 second.");
}
}
sleep(sleepTime);
} catch (InterruptedException e) {
// ignore it
- Thread.currentThread().interrupted();
+ Thread.interrupted();
continue;
} //catch
if (pool.getPoolProperties().isTestWhileIdle())
pool.testAllIdle();
} catch (Exception x) {
- pool.log.error("", x);
+ log.error("", x);
} //catch
} //end if
} //while
log.debug("Unable to connect to database.", x);
}
if (parent.jmxPool!=null) {
- parent.jmxPool.notify(parent.jmxPool.NOTIFY_CONNECT, parent.getStackTrace(x));
+ parent.jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_CONNECT,
+ ConnectionPool.getStackTrace(x));
}
if (x instanceof SQLException) {
throw (SQLException)x;
BasicDataSourceFactory factory = new BasicDataSourceFactory();
Properties p = new Properties();
- for (int i=0; i<this.ALL_PROPERTIES.length; i++) {
+ for (int i=0; i< ALL_PROPERTIES.length; i++) {
String name = "get" + Character.toUpperCase(ALL_PROPERTIES[i].charAt(0)) + ALL_PROPERTIES[i].substring(1);
String bname = "is" + name.substring(3);
Method get = null;
}
}
}
- tDatasource = (BasicDataSource)factory.createDataSource(p);
+ tDatasource = (BasicDataSource) BasicDataSourceFactory.createDataSource(p);
}catch (Exception x) {
x.printStackTrace();
}
st.close();
}
try {
- this.sleep(FairnessTest.this.sleep);
+ sleep(FairnessTest.this.sleep);
} catch (InterruptedException x) {
- this.interrupted();
+ interrupted();
}
} finally {
long cstart = System.nanoTime();
try {
Thread.sleep(100); //simulate work
}catch (InterruptedException x) {
- Thread.currentThread().interrupted();
+ Thread.interrupted();
}
}
con = future.get(); //should return instantly
Future<Object> future = queue.pollAsync();
try {
future.get(2000, TimeUnit.MILLISECONDS);
- this.assertFalse("Request should have timed out",true);
+ assertFalse("Request should have timed out",true);
}catch (TimeoutException x) {
- this.assertTrue("Request timed out properly",true);
+ assertTrue("Request timed out properly",true);
}catch (Exception x) {
- this.assertTrue("Request threw an error",false);
+ assertTrue("Request threw an error",false);
x.printStackTrace();
}
assertEquals(future.get(),item);
}
public void run() {
try {
- this.sleep(delay);
+ sleep(delay);
}catch (Exception ignore){}
offered = true;
TestAsyncQueue.this.queue.offer(item);
Thread.sleep(15000);
try {
c1.createStatement();
- this.assertTrue("Connection should have been abandoned.",false);
+ assertTrue("Connection should have been abandoned.",false);
}catch (Exception x) {
- this.assertTrue("This is correct, c1 is abandoned",true);
+ assertTrue("This is correct, c1 is abandoned",true);
}
try {
c2.createStatement();
- this.assertTrue("Connection should not have been abandoned.",true);
+ assertTrue("Connection should not have been abandoned.",true);
}catch (Exception x) {
- this.assertTrue("Connection c2 should be working",false);
+ assertTrue("Connection c2 should be working",false);
}
try {
- this.assertTrue("Connection should have been closed.",c1.isClosed());
+ assertTrue("Connection should have been closed.",c1.isClosed());
}catch (Exception x) {
- this.assertTrue("This is correct, c1 is closed",true);
+ assertTrue("This is correct, c1 is closed",true);
}
try {
- this.assertFalse("Connection c2 should not have been closed.",c2.isClosed());
+ assertFalse("Connection c2 should not have been closed.",c2.isClosed());
}catch (Exception x) {
- this.assertTrue("Connection c2 should be working",false);
+ assertTrue("Connection c2 should be working",false);
}