Fix all the static Eclipse warnings
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 15 Jan 2009 22:08:17 +0000 (22:08 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 15 Jan 2009 22:08:17 +0000 (22:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@734838 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java
modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java
modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/SimplePOJOAsyncExample.java
modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestAsyncQueue.java
modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TwoDataSources.java

index be0bb7e..b7c14ff 100644 (file)
@@ -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 {
index d7d935f..9ef0200 100644 (file)
@@ -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
index c6b2647..28326cd 100644 (file)
@@ -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;
index 148c1a8..3821ff9 100644 (file)
@@ -70,7 +70,7 @@ public class DefaultTestCase extends TestCase {
             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;
@@ -90,7 +90,7 @@ public class DefaultTestCase extends TestCase {
                        }
                 }
             }
-            tDatasource = (BasicDataSource)factory.createDataSource(p);
+            tDatasource = (BasicDataSource) BasicDataSourceFactory.createDataSource(p);
         }catch (Exception x) {
             x.printStackTrace();
         }
index db3f4e4..1dac78b 100644 (file)
@@ -208,9 +208,9 @@ public class FairnessTest extends DefaultTestCase {
                             st.close();
                         }
                         try { 
-                            this.sleep(FairnessTest.this.sleep); 
+                            sleep(FairnessTest.this.sleep); 
                         } catch (InterruptedException x) {
-                            this.interrupted();
+                            interrupted();
                         }
                     } finally {
                         long cstart = System.nanoTime();
index 1935cae..455f9a2 100644 (file)
@@ -59,7 +59,7 @@ public class SimplePOJOAsyncExample {
               try {
                   Thread.sleep(100); //simulate work
               }catch (InterruptedException x) {
-                  Thread.currentThread().interrupted();
+                  Thread.interrupted();
               }
           }
           con = future.get(); //should return instantly 
index 8e09755..d8ee55e 100644 (file)
@@ -52,11 +52,11 @@ public class TestAsyncQueue extends TestCase {
         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);
@@ -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);
index e5cbcaa..74e5f5b 100644 (file)
@@ -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);
         }