commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sandy...@apache.org
Subject svn commit: r449881 - in /jakarta/commons/proper/pool/trunk/src: java/org/apache/commons/pool/composite/ test/org/apache/commons/pool/composite/
Date Tue, 26 Sep 2006 01:54:30 GMT
Author: sandymac
Date: Mon Sep 25 18:54:29 2006
New Revision: 449881

URL: http://svn.apache.org/viewvc?view=rev&rev=449881
Log:
Remove the NULL Tracking Policy as it provides minimal benefit and adds a non-trivial amount
of complication to support it.

Removed:
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/NullTracker.java
    jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestNullTracker.java
Modified:
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/CompositeObjectPoolFactory.java
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/TrackingPolicy.java
    jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestAll.java
    jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPool.java
    jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPoolFactory.java

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/CompositeObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/CompositeObjectPoolFactory.java?view=diff&rev=449881&r1=449880&r2=449881
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/CompositeObjectPoolFactory.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/CompositeObjectPoolFactory.java
Mon Sep 25 18:54:29 2006
@@ -352,9 +352,6 @@
 
         final int maxActive = config.maxActive;
         if (maxActive > 0) {
-            if (TrackingPolicy.NULL.equals(config.trackingPolicy)) {
-                throw new IllegalStateException("Using the NULL tracker and limiting pool
size is not valid.");
-            }
             final LimitPolicy limitPolicy = config.limitPolicy;
             if (LimitPolicy.FAIL.equals(limitPolicy)) {
                 manager = new FailLimitManager(manager);
@@ -385,8 +382,6 @@
         final TrackingPolicy trackingPolicy = config.trackingPolicy;
         if (TrackingPolicy.SIMPLE.equals(trackingPolicy)) {
             tracker = new SimpleTracker();
-        } else if (TrackingPolicy.NULL.equals(trackingPolicy)) {
-            tracker = new NullTracker();
         } else if (TrackingPolicy.REFERENCE.equals(trackingPolicy)) {
             tracker = new ReferenceTracker();
         } else if (TrackingPolicy.DEBUG.equals(trackingPolicy)) {

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/TrackingPolicy.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/TrackingPolicy.java?view=diff&rev=449881&r1=449880&r2=449881
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/TrackingPolicy.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/TrackingPolicy.java
Mon Sep 25 18:54:29 2006
@@ -29,18 +29,12 @@
  * @since #.#
  * @version $Revision$ $Date$
  */
-/* XXX For Pool 3: public enum TrackingPolicy {NULL, SIMPLE, REFERENCE, DEBUG} but keep existing
Javadoc. */
+/* XXX For Pool 3: public enum TrackingPolicy {SIMPLE, REFERENCE, DEBUG} but keep existing
Javadoc. */
 public final class TrackingPolicy implements Serializable {
 
     private static final long serialVersionUID = 181851949909846032L;
 
     /**
-     * Do not track how objects are borrowed from the pool. While this is the fastest tracking
type it is
-     * incompatible with pools that limit the number of objects in the pool.
-     */
-    public static final TrackingPolicy NULL = new TrackingPolicy("NULL");
-
-    /**
      * Borrowed object tracker that trusts you'll return the objects you borrow. This is
the most common method of
      * tracking active objects. If you return more objects than you borrow then this will
throw an
      * {@link IllegalStateException}.
@@ -77,7 +71,7 @@
 
     // Autogenerated with Java 1.5 enums
     public static TrackingPolicy[] values() {
-        return new TrackingPolicy[] {NULL, SIMPLE, REFERENCE, DEBUG};
+        return new TrackingPolicy[] {SIMPLE, REFERENCE, DEBUG};
     }
 
     // necessary for serialization

Modified: jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestAll.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestAll.java?view=diff&rev=449881&r1=449880&r2=449881
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestAll.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestAll.java
Mon Sep 25 18:54:29 2006
@@ -55,7 +55,6 @@
         suite.addTest(TestWaitLimitManager.suite());
 
         // Tackers unit tests
-        suite.addTest(TestNullTracker.suite());
         suite.addTest(TestReferenceTracker.suite());
         suite.addTest(TestDebugTracker.suite());
         suite.addTest(TestSimpleTracker.suite());

Modified: jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPool.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPool.java?view=diff&rev=449881&r1=449880&r2=449881
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPool.java
Mon Sep 25 18:54:29 2006
@@ -326,22 +326,6 @@
     // Test Trackers --------------------------------------
 
     /**
-     * Make sure the {@link NullTracker} doesn't do anything and throws an {@link UnsupportedOperationException}.
-     */
-    public void testNullTracker() throws Exception {
-        pool = new CompositeObjectPool(new IntegerFactory(), new GrowManager(), new FifoLender(),
new NullTracker(), false);
-        assertTrue("Expected negative value.", pool.getNumActive() < 0);
-
-        final Integer zero = (Integer)pool.borrowObject();
-
-        assertTrue("Expected negative value.", pool.getNumActive() < 0);
-
-        pool.returnObject(zero);
-
-        assertTrue("Expected negative value.", pool.getNumActive() < 0);
-    }
-
-    /**
      * Make sure {@link SimpleTracker} counts the number of borrowed and returned objects
and that an
      * {@link IllegalStateException} is thrown when more objects are returned than were borrowed.
      */

Modified: jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPoolFactory.java?view=diff&rev=449881&r1=449880&r2=449881
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPoolFactory.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPoolFactory.java
Mon Sep 25 18:54:29 2006
@@ -241,18 +241,6 @@
         }
     }
 
-    public void testTrackingPolicyNull() throws Exception {
-        final CompositeObjectPoolFactory copf = (CompositeObjectPoolFactory)makeFactory();
-        copf.setTrackingPolicy(TrackingPolicy.NULL);
-        final ObjectPool pool = copf.createPool();
-
-        assertTrue(pool.getNumActive() < 0);
-        Object a = pool.borrowObject();
-        assertTrue(pool.getNumActive() < 0);
-        pool.returnObject(a);
-        assertTrue(pool.getNumActive() < 0);
-    }
-
     public void testTrackingPolicySimple() throws Exception {
         final CompositeObjectPoolFactory copf = (CompositeObjectPoolFactory)makeFactory();
         copf.setTrackingPolicy(TrackingPolicy.SIMPLE);



---------------------------------------------------------------------
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