commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1101901 - in /commons/proper/pool/trunk/src: changes/ java/org/apache/commons/pool2/impl/ test/org/apache/commons/pool2/impl/
Date Wed, 11 May 2011 14:44:23 GMT
Author: markt
Date: Wed May 11 14:44:23 2011
New Revision: 1101901

URL: http://svn.apache.org/viewvc?rev=1101901&view=rev
Log:
Make more attributes private.

Modified:
    commons/proper/pool/trunk/src/changes/changes.xml
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPool.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPoolFactory.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPool.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPoolFactory.java

Modified: commons/proper/pool/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1101901&r1=1101900&r2=1101901&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/changes/changes.xml (original)
+++ commons/proper/pool/trunk/src/changes/changes.xml Wed May 11 14:44:23 2011
@@ -33,8 +33,8 @@
       Lea and the JSR-166 expert group).
     </action>
     <action dev="markt" type="update">
-      Make deprecated PoolFactory attributes private, requiring that access is
-      via the provided getters. 
+      Make deprecated protected attributes private, requiring that access is via
+      the appropriate getters. 
     </action>
   </release>
   <release version="1.5.6" date="2011-04-03" description="This is a patch release, including
bugfixes only.">

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPool.java?rev=1101901&r1=1101900&r2=1101901&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPool.java
Wed May 11 14:44:23 2011
@@ -538,6 +538,10 @@ public class StackKeyedObjectPool<K,V> e
         return _maxSleeping;
     }
 
+    protected void setMaxSleeping(int maxSleeping) {
+        this._maxSleeping = maxSleeping;
+    }
+
     /**
      * @return the initial capacity of each pool.
      * @since 1.5.5
@@ -581,44 +585,37 @@ public class StackKeyedObjectPool<K,V> e
 
     /**
      *  My named-set of pools.
-     *  @deprecated to be removed in pool 2.0.  Use {@link #getPools()}
      */
-    protected HashMap<K,Stack<V>> _pools = null;
+    private HashMap<K,Stack<V>> _pools = null;
 
     /**
      * My {@link KeyedPoolableObjectFactory}.
-     * @deprecated to be removed in pool 2.0.  Use {@link #getFactory()}
      */
-    protected KeyedPoolableObjectFactory<K,V> _factory = null;
+    private KeyedPoolableObjectFactory<K,V> _factory = null;
 
     /**
      *  The cap on the number of "sleeping" instances in <code>each</code> pool.
-     *  @deprecated to be removed in pool 2.0.  Use {@link #getMaxSleeping()}
      */
-    protected int _maxSleeping = DEFAULT_MAX_SLEEPING;
+    private int _maxSleeping = DEFAULT_MAX_SLEEPING;
 
     /**
      * The initial capacity of each pool.
-     * @deprecated to be removed in pool 2.0.  Use {@link #getInitSleepingCapacity()}.
      */
-    protected int _initSleepingCapacity = DEFAULT_INIT_SLEEPING_CAPACITY;
+    private int _initSleepingCapacity = DEFAULT_INIT_SLEEPING_CAPACITY;
 
     /**
      * Total number of object borrowed and not yet returned for all pools.
-     * @deprecated to be removed in pool 2.0.  Use {@link #getTotActive()}.
      */
-    protected int _totActive = 0;
+    private int _totActive = 0;
 
     /**
      * Total number of objects "sleeping" for all pools
-     * @deprecated to be removed in pool 2.0.  Use {@link #getTotIdle()}.
      */
-    protected int _totIdle = 0;
+    private int _totIdle = 0;
 
     /**
      * Number of active objects borrowed and not yet returned by pool
-     * @deprecated to be removed in pool 2.0.  Use {@link #getActiveCount()}.
      */
-    protected HashMap<K,Integer> _activeCount = null;
+    private HashMap<K,Integer> _activeCount = null;
 
 }

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPoolFactory.java?rev=1101901&r1=1101900&r2=1101901&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPoolFactory.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPoolFactory.java
Wed May 11 14:44:23 2011
@@ -113,21 +113,18 @@ public class StackKeyedObjectPoolFactory
 
     /** 
      * KeyedPoolableObjectFactory used by StackKeyedObjectPools created by this factory
-     * @deprecated to be removed in pool 2.0 
      */
-    protected KeyedPoolableObjectFactory<K,V> _factory = null;
+    private KeyedPoolableObjectFactory<K,V> _factory = null;
     
     /** 
      * Maximum number of idle instances in each keyed pool for StackKeyedObjectPools created
by this factory
-     * @deprecated to be removed in pool 2.0
      */
-    protected int _maxSleeping = StackKeyedObjectPool.DEFAULT_MAX_SLEEPING;
+    private int _maxSleeping = StackKeyedObjectPool.DEFAULT_MAX_SLEEPING;
     
     /**
      * Initial capacity of StackKeyedObjectPools created by this factory.
-     * @deprecated to be removed in pool 2.0
      */
-    protected int _initCapacity = StackKeyedObjectPool.DEFAULT_INIT_SLEEPING_CAPACITY;
+    private int _initCapacity = StackKeyedObjectPool.DEFAULT_INIT_SLEEPING_CAPACITY;
 
     /**
      * Returns the KeyedPoolableObjectFactory used by StackKeyedObjectPools created by this
factory

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java?rev=1101901&r1=1101900&r2=1101901&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
Wed May 11 14:44:23 2011
@@ -418,27 +418,23 @@ public class StackObjectPool<T> extends 
 
     /** 
      * My pool.
-     * @deprecated to be made private in pool 2.0 
      */
-    protected Stack<T> _pool = null;
+    private Stack<T> _pool = null;
 
     /** 
      * My {@link PoolableObjectFactory}.
-     * @deprecated to be made private in pool 2.0 - use {@link #getFactory()}
      */
-    protected PoolableObjectFactory<T> _factory = null;
+    private PoolableObjectFactory<T> _factory = null;
 
     /** 
      * The cap on the number of "sleeping" instances in the pool. 
-     * @deprecated to be made private in pool 2.0 - use {@link #getMaxSleeping()}
      */
-    protected int _maxSleeping = DEFAULT_MAX_SLEEPING;
+    private int _maxSleeping = DEFAULT_MAX_SLEEPING;
     
     /**
      * Number of objects borrowed but not yet returned to the pool.
-     * @deprecated to be made private in pool 2.0 - use {@link #getNumActive()}
      */
-    protected int _numActive = 0;
+    private int _numActive = 0;
 
     /**
      * Returns the {@link PoolableObjectFactory} used by this pool to create and manage object
instances.

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java?rev=1101901&r1=1101900&r2=1101901&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java
Wed May 11 14:44:23 2011
@@ -113,21 +113,18 @@ public class StackObjectPoolFactory<T> i
 
     /**
      * The PoolableObjectFactory used by created pools.
-     * @deprecated to be made private in pool 2.0
      */
-    protected PoolableObjectFactory<T> _factory = null;
+    private PoolableObjectFactory<T> _factory = null;
     
     /**
      * The maximum number of idle instances in created pools.
-     * @deprecated to be made private in pool 2.0
      */
-    protected int _maxSleeping = StackObjectPool.DEFAULT_MAX_SLEEPING;
+    private int _maxSleeping = StackObjectPool.DEFAULT_MAX_SLEEPING;
     
     /**
      * The initial size of created pools.
-     * @deprecated to be made private in pool 2.0
      */
-    protected int _initCapacity = StackObjectPool.DEFAULT_INIT_SLEEPING_CAPACITY;
+    private int _initCapacity = StackObjectPool.DEFAULT_INIT_SLEEPING_CAPACITY;
 
     /**
      * Returns the factory used by created pools.

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPool.java?rev=1101901&r1=1101900&r2=1101901&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPool.java
Wed May 11 14:44:23 2011
@@ -129,7 +129,7 @@ public class TestStackKeyedObjectPool ex
      */
     @Test
     public void testRemoveOldest() throws Exception {
-        pool._maxSleeping = 2;
+        pool.setMaxSleeping(2);
         Object obj0 = pool.borrowObject("");
         Object obj1 = pool.borrowObject("");
         Object obj2 = pool.borrowObject("");

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPoolFactory.java?rev=1101901&r1=1101900&r2=1101901&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPoolFactory.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPoolFactory.java
Wed May 11 14:44:23 2011
@@ -44,13 +44,13 @@ public class TestStackKeyedObjectPoolFac
 
         factory = new StackKeyedObjectPoolFactory<Object,Object>(1);
         StackKeyedObjectPool<Object,Object> pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
-        assertEquals(1,pool._maxSleeping);
+        assertEquals(1,pool.getMaxSleeping());
         pool.close();
 
         factory = new StackKeyedObjectPoolFactory<Object,Object>(1, 2);
         pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
-        assertEquals(1,pool._maxSleeping);
-        assertEquals(2,pool._initSleepingCapacity);
+        assertEquals(1,pool.getMaxSleeping());
+        assertEquals(2,pool.getInitSleepingCapacity());
         pool.close();
 
         factory = new StackKeyedObjectPoolFactory<Object,Object>(createObjectFactory());
@@ -59,13 +59,13 @@ public class TestStackKeyedObjectPoolFac
 
         factory = new StackKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
 1);
         pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
-        assertEquals(1,pool._maxSleeping);
+        assertEquals(1,pool.getMaxSleeping());
         pool.close();
 
         factory = new StackKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
 1, 2);
         pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
-        assertEquals(1,pool._maxSleeping);
-        assertEquals(2,pool._initSleepingCapacity);
+        assertEquals(1,pool.getMaxSleeping());
+        assertEquals(2,pool.getInitSleepingCapacity());
         pool.close();
 
     }



Mime
View raw message