commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons/pool/src/test/org/apache/commons/pool/impl TestGenericObjectPool.java TestGenericKeyedObjectPool.java
Date Wed, 05 Mar 2003 19:22:53 GMT
rwaldhoff    2003/03/05 11:22:53

  Modified:    pool/src/java/org/apache/commons/pool/impl
                        GenericObjectPool.java GenericKeyedObjectPool.java
               pool/src/test/org/apache/commons/pool/impl
                        TestGenericObjectPool.java
                        TestGenericKeyedObjectPool.java
  Log:
  correct access of static methods/members via a non-static reference
  
  Revision  Changes    Path
  1.13      +5 -5      jakarta-commons/pool/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
  
  Index: GenericObjectPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/pool/src/java/org/apache/commons/pool/impl/GenericObjectPool.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- GenericObjectPool.java	1 Dec 2002 18:29:06 -0000	1.12
  +++ GenericObjectPool.java	5 Mar 2003 19:22:52 -0000	1.13
  @@ -987,7 +987,7 @@
           public void run() {
               while(!_cancelled) {
                   try {
  -                    Thread.currentThread().sleep(_delay);
  +                    Thread.sleep(_delay);
                   } catch(Exception e) {
                       // ignored
                   }
  
  
  
  1.12      +5 -5      jakarta-commons/pool/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
  
  Index: GenericKeyedObjectPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/pool/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- GenericKeyedObjectPool.java	5 Mar 2003 19:17:08 -0000	1.11
  +++ GenericKeyedObjectPool.java	5 Mar 2003 19:22:52 -0000	1.12
  @@ -1153,7 +1153,7 @@
                       sleeptime = _timeBetweenEvictionRunsMillis;
                   }
                   try {
  -                    Thread.currentThread().sleep(sleeptime);
  +                    Thread.sleep(sleeptime);
                   } catch(Exception e) {
                       ; // ignored
                   }
  
  
  
  1.9       +22 -22    jakarta-commons/pool/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java
  
  Index: TestGenericObjectPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/pool/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestGenericObjectPool.java	31 Oct 2002 00:06:19 -0000	1.8
  +++ TestGenericObjectPool.java	5 Mar 2003 19:22:52 -0000	1.9
  @@ -120,7 +120,7 @@
   
       public void testZeroMaxActive() throws Exception {
           pool.setMaxActive(0);
  -        pool.setWhenExhaustedAction(pool.WHEN_EXHAUSTED_FAIL);
  +        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
           Object obj = pool.borrowObject();
           assertEquals(getNthObject(0),obj);
           pool.returnObject(obj);
  @@ -128,7 +128,7 @@
   
       public void testNegativeMaxActive() throws Exception {
           pool.setMaxActive(-1);
  -        pool.setWhenExhaustedAction(pool.WHEN_EXHAUSTED_FAIL);
  +        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
           Object obj = pool.borrowObject();
           assertEquals(getNthObject(0),obj);
           pool.returnObject(obj);
  @@ -152,7 +152,7 @@
   
       public void testMaxActive() throws Exception {
           pool.setMaxActive(3);
  -        pool.setWhenExhaustedAction(pool.WHEN_EXHAUSTED_FAIL);
  +        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
   
           pool.borrowObject();
           pool.borrowObject();
  @@ -180,17 +180,17 @@
               pool.returnObject(active[i]);
           }
   
  -        try { Thread.currentThread().sleep(1000L); } catch(Exception e) { }
  +        try { Thread.sleep(1000L); } catch(Exception e) { }
           assertTrue("Should be less than 500 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 500);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 400 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 400);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 300 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 300);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 200 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 200);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 100 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 100);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertEquals("Should be zero idle, found " + pool.getNumIdle(),0,pool.getNumIdle());
   
           for(int i=0;i<500;i++) {
  @@ -200,17 +200,17 @@
               pool.returnObject(active[i]);
           }
   
  -        try { Thread.currentThread().sleep(1000L); } catch(Exception e) { }
  +        try { Thread.sleep(1000L); } catch(Exception e) { }
           assertTrue("Should be less than 500 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 500);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 400 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 400);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 300 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 300);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 200 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 200);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 100 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 100);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertEquals("Should be zero idle, found " + pool.getNumIdle(),0,pool.getNumIdle());
       }
   
  @@ -228,7 +228,7 @@
           for(int i=0;i<20;i++) {
               while(!(threads[i]).complete()) {
                   try {
  -                    Thread.currentThread().sleep(500L);
  +                    Thread.sleep(500L);
                   } catch(Exception e) {
                       // ignored
                   }
  @@ -273,7 +273,7 @@
           public void run() {
               for(int i=0;i<_iter;i++) {
                   try {
  -                    Thread.currentThread().sleep((long)_random.nextInt(_delay));
  +                    Thread.sleep((long)_random.nextInt(_delay));
                   } catch(Exception e) {
                       // ignored
                   }
  @@ -287,7 +287,7 @@
                   }
   
                   try {
  -                    Thread.currentThread().sleep((long)_random.nextInt(_delay));
  +                    Thread.sleep((long)_random.nextInt(_delay));
                   } catch(Exception e) {
                       // ignored
                   }
  
  
  
  1.10      +33 -33    jakarta-commons/pool/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java
  
  Index: TestGenericKeyedObjectPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/pool/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestGenericKeyedObjectPool.java	31 Oct 2002 15:09:10 -0000	1.9
  +++ TestGenericKeyedObjectPool.java	5 Mar 2003 19:22:53 -0000	1.10
  @@ -138,7 +138,7 @@
   
       public void testZeroMaxActive() throws Exception {
           pool.setMaxActive(0);
  -        pool.setWhenExhaustedAction(pool.WHEN_EXHAUSTED_FAIL);
  +        pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL);
           Object obj = pool.borrowObject("");
           assertEquals("0",obj);
           pool.returnObject("",obj);
  @@ -146,7 +146,7 @@
   
       public void testNegativeMaxActive() throws Exception {
           pool.setMaxActive(-1);
  -        pool.setWhenExhaustedAction(pool.WHEN_EXHAUSTED_FAIL);
  +        pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL);
           Object obj = pool.borrowObject("");
           assertEquals("0",obj);
           pool.returnObject("",obj);
  @@ -219,7 +219,7 @@
   
       public void testMaxActive() throws Exception {
           pool.setMaxActive(3);
  -        pool.setWhenExhaustedAction(pool.WHEN_EXHAUSTED_FAIL);
  +        pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL);
   
           pool.borrowObject("");
           pool.borrowObject("");
  @@ -247,17 +247,17 @@
               pool.returnObject("",active[i]);
           }
   
  -        try { Thread.currentThread().sleep(1000L); } catch(Exception e) { }
  +        try { Thread.sleep(1000L); } catch(Exception e) { }
           assertTrue("Should be less than 500 idle, found " + pool.getNumIdle(""),pool.getNumIdle("")
< 500);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 400 idle, found " + pool.getNumIdle(""),pool.getNumIdle("")
< 400);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 300 idle, found " + pool.getNumIdle(""),pool.getNumIdle("")
< 300);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 200 idle, found " + pool.getNumIdle(""),pool.getNumIdle("")
< 200);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 100 idle, found " + pool.getNumIdle(""),pool.getNumIdle("")
< 100);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertEquals("Should be zero idle, found " + pool.getNumIdle(""),0,pool.getNumIdle(""));
   
           for(int i=0;i<500;i++) {
  @@ -267,17 +267,17 @@
               pool.returnObject("",active[i]);
           }
   
  -        try { Thread.currentThread().sleep(1000L); } catch(Exception e) { }
  +        try { Thread.sleep(1000L); } catch(Exception e) { }
           assertTrue("Should be less than 500 idle, found " + pool.getNumIdle(""),pool.getNumIdle("")
< 500);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 400 idle, found " + pool.getNumIdle(""),pool.getNumIdle("")
< 400);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 300 idle, found " + pool.getNumIdle(""),pool.getNumIdle("")
< 300);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 200 idle, found " + pool.getNumIdle(""),pool.getNumIdle("")
< 200);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 100 idle, found " + pool.getNumIdle(""),pool.getNumIdle("")
< 100);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertEquals("Should be zero idle, found " + pool.getNumIdle(""),0,pool.getNumIdle(""));
       }
   
  @@ -299,27 +299,27 @@
               pool.returnObject("2",active2[i]);
           }
   
  -        try { Thread.currentThread().sleep(1000L); } catch(Exception e) { }
  +        try { Thread.sleep(1000L); } catch(Exception e) { }
           assertTrue("Should be less than 1000 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 1000);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 900 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 900);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 800 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 800);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 700 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 700);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 600 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 600);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 500 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 500);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 400 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 400);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 300 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 300);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 200 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 200);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertTrue("Should be less than 100 idle, found " + pool.getNumIdle(),pool.getNumIdle()
< 100);
  -        try { Thread.currentThread().sleep(600L); } catch(Exception e) { }
  +        try { Thread.sleep(600L); } catch(Exception e) { }
           assertEquals("Should be zero idle, found " + pool.getNumIdle(),0,pool.getNumIdle());
       }
   
  @@ -336,7 +336,7 @@
           for(int i=0;i<20;i++) {
               while(!(threads[i]).complete()) {
                   try {
  -                    Thread.currentThread().sleep(500L);
  +                    Thread.sleep(500L);
                   } catch(Exception e) {
                       // ignored
                   }
  @@ -382,7 +382,7 @@
               for(int i=0;i<_iter;i++) {
                   String key = String.valueOf(_random.nextInt(3));
                   try {
  -                    Thread.currentThread().sleep((long)_random.nextInt(_delay));
  +                    Thread.sleep((long)_random.nextInt(_delay));
                   } catch(Exception e) {
                       // ignored
                   }
  @@ -396,7 +396,7 @@
                   }
   
                   try {
  -                    Thread.currentThread().sleep((long)_random.nextInt(_delay));
  +                    Thread.sleep((long)_random.nextInt(_delay));
                   } catch(Exception e) {
                       // ignored
                   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message