From 1e4466833121467b5cb005ac2f3342f0da8515b0 Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 15 Jan 2009 22:08:17 +0000 Subject: [PATCH] Fix all the static Eclipse warnings git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@734838 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tomcat/util/threads/ThreadPoolExecutor.java | 2 +- .../org/apache/tomcat/jdbc/pool/ConnectionPool.java | 18 +++++++++--------- .../org/apache/tomcat/jdbc/pool/PooledConnection.java | 3 ++- .../org/apache/tomcat/jdbc/test/DefaultTestCase.java | 4 ++-- .../test/org/apache/tomcat/jdbc/test/FairnessTest.java | 4 ++-- .../tomcat/jdbc/test/SimplePOJOAsyncExample.java | 2 +- .../org/apache/tomcat/jdbc/test/TestAsyncQueue.java | 8 ++++---- .../org/apache/tomcat/jdbc/test/TwoDataSources.java | 16 ++++++++-------- 8 files changed, 29 insertions(+), 28 deletions(-) diff --git a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java index be0bb7e33..b7c14ff9d 100644 --- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java +++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java @@ -98,7 +98,7 @@ public class ThreadPoolExecutor extends java.util.concurrent.ThreadPoolExecutor throw new RejectedExecutionException("Queue capacity is full."); } } catch (InterruptedException x) { - Thread.currentThread().interrupted(); + Thread.interrupted(); throw new RejectedExecutionException(x); } } else { diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java index d7d935fab..9ef02005b 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java @@ -281,7 +281,7 @@ public class ConnectionPool { con = pool.poll(1000, TimeUnit.MILLISECONDS); } //while } catch (InterruptedException ex) { - Thread.currentThread().interrupted(); + Thread.interrupted(); } if (pool.size()==0 && force && pool!=busy) pool = busy; } @@ -349,7 +349,7 @@ public class ConnectionPool { 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); @@ -364,7 +364,7 @@ public class ConnectionPool { } //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 { @@ -400,7 +400,7 @@ public class ConnectionPool { 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 { @@ -465,7 +465,7 @@ public class ConnectionPool { //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()+"] " + @@ -878,10 +878,10 @@ public class ConnectionPool { 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."); } } @@ -891,7 +891,7 @@ public class ConnectionPool { sleep(sleepTime); } catch (InterruptedException e) { // ignore it - Thread.currentThread().interrupted(); + Thread.interrupted(); continue; } //catch @@ -908,7 +908,7 @@ public class ConnectionPool { if (pool.getPoolProperties().isTestWhileIdle()) pool.testAllIdle(); } catch (Exception x) { - pool.log.error("", x); + log.error("", x); } //catch } //end if } //while diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java index c6b26474a..28326cd20 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java @@ -92,7 +92,8 @@ public class PooledConnection { 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; diff --git a/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java b/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java index 148c1a811..3821ff9ef 100644 --- a/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java +++ b/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java @@ -70,7 +70,7 @@ public class DefaultTestCase extends TestCase { BasicDataSourceFactory factory = new BasicDataSourceFactory(); Properties p = new Properties(); - for (int i=0; i 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); @@ -74,7 +74,7 @@ public class TestAsyncQueue extends TestCase { } public void run() { try { - this.sleep(delay); + sleep(delay); }catch (Exception ignore){} offered = true; TestAsyncQueue.this.queue.offer(item); diff --git a/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TwoDataSources.java b/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TwoDataSources.java index e5cbcaabd..74e5f5ba1 100644 --- a/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TwoDataSources.java +++ b/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TwoDataSources.java @@ -39,26 +39,26 @@ public class TwoDataSources extends DefaultTestCase { 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); } -- 2.11.0