You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2009/05/21 13:12:59 UTC

svn commit: r777065 [2/2] - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool: ./ impl/

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=777065&r1=777064&r2=777065&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java Thu May 21 11:12:58 2009
@@ -4,10 +4,10 @@
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
+ * the License.  You may obtain a copy of the License a
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,7 +50,7 @@
  *  <li>
  *    {@link #setMaxIdle <i>maxIdle</i>} controls the maximum number of objects
  *    that can sit idle in the pool at any time.  When negative, there is no
- *    limit to the number of objects that may be idle at one time. The default
+ *    limit to the number of objects that may be idle at one time. The defaul
  *    setting for this parameter is 8.
  *  </li>
  *  <li>
@@ -73,7 +73,7 @@
  *      is {@link #WHEN_EXHAUSTED_BLOCK}, {@link #borrowObject} will block
  *      (invoke {@link Object#wait()}) until a new or idle object is available.
  *      If a positive {@link #setMaxWait <i>maxWait</i>}
- *      value is supplied, then {@link #borrowObject} will block for at
+ *      value is supplied, then {@link #borrowObject} will block for a
  *      most that many milliseconds, after which a {@link NoSuchElementException}
  *      will be thrown.  If {@link #setMaxWait <i>maxWait</i>} is non-positive,
  *      the {@link #borrowObject} method will block indefinitely.
@@ -123,57 +123,57 @@
  *  <li>
  *   {@link #setMinEvictableIdleTimeMillis <i>minEvictableIdleTimeMillis</i>}
  *   specifies the minimum amount of time that an object may sit idle in the pool
- *   before it is eligible for eviction due to idle time.  When non-positive, no object
+ *   before it is eligible for eviction due to idle time.  When non-positive, no objec
  *   will be dropped from the pool due to idle time alone. This setting has no
- *   effect unless <code>timeBetweenEvictionRunsMillis > 0.</code> The default
+ *   effect unless <code>timeBetweenEvictionRunsMillis > 0.</code> The defaul
  *   setting for this parameter is 30 minutes.
  *  </li>
  *  <li>
  *   {@link #setTestWhileIdle <i>testWhileIdle</i>} indicates whether or not idle
  *   objects should be validated using the factory's
  *   {@link PoolableObjectFactory#validateObject} method. Objects that fail to
- *   validate will be dropped from the pool. This setting has no effect unless 
+ *   validate will be dropped from the pool. This setting has no effect unless
  *   <code>timeBetweenEvictionRunsMillis > 0.</code>  The default setting for
  *   this parameter is <code>false.</code>
  *  </li>
  *  <li>
- *   {@link #setSoftMinEvictableIdleTimeMillis <i>softMinEvictableIdleTimeMillis</i>} 
+ *   {@link #setSoftMinEvictableIdleTimeMillis <i>softMinEvictableIdleTimeMillis</i>}
  *   specifies the minimum amount of time an object may sit idle in the pool
  *   before it is eligible for eviction by the idle object evictor
- *   (if any), with the extra condition that at least "minIdle" object instances 
+ *   (if any), with the extra condition that at least "minIdle" object instances
  *   remain in the pool.  When non-positive, no objects will be evicted from the pool
  *   due to idle time alone. This setting has no effect unless
  *   <code>timeBetweenEvictionRunsMillis > 0.</code> and it is superceded by
- *   {@link #setMinEvictableIdleTimeMillis <i>minEvictableIdleTimeMillis</i>} 
- *   (that is, if <code>minEvictableIdleTimeMillis</code> is positive, then 
+ *   {@link #setMinEvictableIdleTimeMillis <i>minEvictableIdleTimeMillis</i>}
+ *   (that is, if <code>minEvictableIdleTimeMillis</code> is positive, then
  *   <code>softMinEvictableIdleTimeMillis</code> is ignored). The default setting for
  *   this parameter is -1 (disabled).
  *  </li>
  *  <li>
  *   {@link #setNumTestsPerEvictionRun <i>numTestsPerEvictionRun</i>}
- *   determines the number of objects examined in each run of the idle object
- *   evictor. This setting has no effect unless 
+ *   determines the number of objects examined in each run of the idle objec
+ *   evictor. This setting has no effect unless
  *   <code>timeBetweenEvictionRunsMillis > 0.</code>  The default setting for
- *   this parameter is 3.  
+ *   this parameter is 3.
  *  </li>
  * </ul>
  * <p>
  * <p>
  * The pool can be configured to behave as a LIFO queue with respect to idle
  * objects - always returning the most recently used object from the pool,
- * or as a FIFO queue, where borrowObject always returns the oldest object
+ * or as a FIFO queue, where borrowObject always returns the oldest objec
  * in the idle object pool.
  * <ul>
  *  <li>
  *   {@link #setLifo <i>lifo</i>}
- *   determines whether or not the pool returns idle objects in 
+ *   determines whether or not the pool returns idle objects in
  *   last-in-first-out order. The default setting for this parameter is
  *   <code>true.</code>
  *  </li>
  * </ul>
  * <p>
  * GenericObjectPool is not usable without a {@link PoolableObjectFactory}.  A
- * non-<code>null</code> factory must be provided either as a constructor argument
+ * non-<code>null</code> factory must be provided either as a constructor argumen
  * or via a call to {@link #setFactory} before the pool is used.
  * <p>
  * Implementation note: To prevent possible deadlocks, care has been taken to
@@ -210,8 +210,8 @@
      * {@link #getMaxWait maximum wait time} has been reached.
      * @see #WHEN_EXHAUSTED_FAIL
      * @see #WHEN_EXHAUSTED_GROW
-     * @see #setMaxWait
-     * @see #getMaxWait
+     * @see #setMaxWai
+     * @see #getMaxWai
      * @see #setWhenExhaustedAction
      */
     public static final byte WHEN_EXHAUSTED_BLOCK  = 1;
@@ -256,12 +256,12 @@
      * @see #setWhenExhaustedAction
      */
     public static final byte DEFAULT_WHEN_EXHAUSTED_ACTION = WHEN_EXHAUSTED_BLOCK;
-    
+
     /**
      * The default LIFO status. True means that borrowObject returns the
      * most recently used ("last in") idle object in the pool (if there are
      * idle instances available).  False means that the pool behaves as a FIFO
-     * queue - objects are taken from the idle object pool in the order that
+     * queue - objects are taken from the idle object pool in the order tha
      * they are returned to the pool.
      * @see #setLifo
      * @since 1.4
@@ -274,8 +274,8 @@
      * an exception when the pool is exhausted and the
      * {@link #getWhenExhaustedAction "when exhausted" action} is
      * {@link #WHEN_EXHAUSTED_BLOCK}.
-     * @see #getMaxWait
-     * @see #setMaxWait
+     * @see #getMaxWai
+     * @see #setMaxWai
      */
     public static final long DEFAULT_MAX_WAIT = -1L;
 
@@ -475,7 +475,7 @@
     public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, long softMinEvictableIdleTimeMillis) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle, minIdle, testOnBorrow, testOnReturn, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minEvictableIdleTimeMillis, testWhileIdle, softMinEvictableIdleTimeMillis, DEFAULT_LIFO);
     }
-    
+
     /**
      * Create a new <tt>GenericObjectPool</tt> using the specified values.
      * @param factory the (possibly <tt>null</tt>)PoolableObjectFactory to use to create, validate and destroy objects
@@ -531,7 +531,7 @@
      * (checked out to clients, or idle awaiting checkout) at a given time.
      * When non-positive, there is no limit to the number of objects that can
      * be managed by the pool at one time.
-     * 
+     *
      * @return the cap on the total number of object instances managed by the pool.
      * @see #setMaxActive
      */
@@ -543,7 +543,7 @@
      * Sets the cap on the number of objects that can be allocated by the pool
      * (checked out to clients, or idle awaiting checkout) at a given time. Use
      * a negative value for no limit.
-     * 
+     *
      * @param maxActive The cap on the total number of object instances managed by the pool.
      * Negative values mean that there is no limit to the number of objects allocated
      * by the pool.
@@ -601,7 +601,7 @@
      * may block indefinitely.
      *
      * @return maximum number of milliseconds to block when borrowing an object.
-     * @see #setMaxWait
+     * @see #setMaxWai
      * @see #setWhenExhaustedAction
      * @see #WHEN_EXHAUSTED_BLOCK
      */
@@ -620,7 +620,7 @@
      * may block indefinitely.
      *
      * @param maxWait maximum number of milliseconds to block when borrowing an object.
-     * @see #getMaxWait
+     * @see #getMaxWai
      * @see #setWhenExhaustedAction
      * @see #WHEN_EXHAUSTED_BLOCK
      */
@@ -659,7 +659,7 @@
     /**
      * Sets the minimum number of objects allowed in the pool
      * before the evictor thread (if active) spawns new objects.
-     * Note that no objects are created when 
+     * Note that no objects are created when
      * <code>numActive + numIdle >= maxActive.</code>
      * This setting has no effect if the idle object evictor is disabled
      * (i.e. if <code>timeBetweenEvictionRunsMillis <= 0</code>).
@@ -690,7 +690,7 @@
      * {@link PoolableObjectFactory#validateObject validated}
      * before being returned by the {@link #borrowObject}
      * method.  If the object fails to validate,
-     * it will be dropped from the pool, and we will attempt
+     * it will be dropped from the pool, and we will attemp
      * to borrow another.
      *
      * @return <code>true</code> if objects are validated before being borrowed.
@@ -705,7 +705,7 @@
      * {@link PoolableObjectFactory#validateObject validated}
      * before being returned by the {@link #borrowObject}
      * method.  If the object fails to validate,
-     * it will be dropped from the pool, and we will attempt
+     * it will be dropped from the pool, and we will attemp
      * to borrow another.
      *
      * @param testOnBorrow <code>true</code> if objects should be validated before being borrowed.
@@ -826,7 +826,7 @@
     /**
      * Returns the minimum amount of time an object may sit idle in the pool
      * before it is eligible for eviction by the idle object evictor
-     * (if any), with the extra condition that at least
+     * (if any), with the extra condition that at leas
      * "minIdle" amount of object remain in the pool.
      *
      * @return minimum amount of time an object may sit idle in the pool before it is eligible for eviction.
@@ -840,7 +840,7 @@
     /**
      * Sets the minimum amount of time an object may sit idle in the pool
      * before it is eligible for eviction by the idle object evictor
-     * (if any), with the extra condition that at least
+     * (if any), with the extra condition that at leas
      * "minIdle" object instances remain in the pool.
      * When non-positive, no objects will be evicted from the pool
      * due to idle time alone.
@@ -856,7 +856,7 @@
     /**
      * When <tt>true</tt>, objects will be
      * {@link PoolableObjectFactory#validateObject validated}
-     * by the idle object evictor (if any).  If an object
+     * by the idle object evictor (if any).  If an objec
      * fails to validate, it will be dropped from the pool.
      *
      * @return <code>true</code> when objects will be validated by the evictor.
@@ -870,7 +870,7 @@
     /**
      * When <tt>true</tt>, objects will be
      * {@link PoolableObjectFactory#validateObject validated}
-     * by the idle object evictor (if any).  If an object
+     * by the idle object evictor (if any).  If an objec
      * fails to validate, it will be dropped from the pool.
      *
      * @param testWhileIdle <code>true</code> so objects will be validated by the evictor.
@@ -880,14 +880,14 @@
     public synchronized void setTestWhileIdle(boolean testWhileIdle) {
         _testWhileIdle = testWhileIdle;
     }
-    
+
     /**
      * Whether or not the idle object pool acts as a LIFO queue. True means
-     * that borrowObject returns the most recently used ("last in") idle object
-     * in the pool (if there are idle instances available).  False means that
-     * the pool behaves as a FIFO queue - objects are taken from the idle object
+     * that borrowObject returns the most recently used ("last in") idle objec
+     * in the pool (if there are idle instances available).  False means tha
+     * the pool behaves as a FIFO queue - objects are taken from the idle objec
      * pool in the order that they are returned to the pool.
-     * 
+     *
      * @return <code>true</true> if the pool is configured to act as a LIFO queue
      * @since 1.4
      */
@@ -899,9 +899,9 @@
       * Sets the LIFO property of the pool. True means that borrowObject returns
       * the most recently used ("last in") idle object in the pool (if there are
       * idle instances available).  False means that the pool behaves as a FIFO
-      * queue - objects are taken from the idle object pool in the order that
+      * queue - objects are taken from the idle object pool in the order tha
       * they are returned to the pool.
-      * 
+      *
       * @param lifo the new value for the LIFO property
       * @since 1.4
       */
@@ -942,13 +942,13 @@
         synchronized (this) {
             // Get local copy of current config. Can't sync when used later as
             // it can result in a deadlock. Has the added advantage that config
-            // is consistent for entire method execution 
+            // is consistent for entire method execution
             whenExhaustedAction = _whenExhaustedAction;
             maxWait = _maxWait;
-            
-            // Add this request to the queue 
+
+            // Add this request to the queue
             _allocationQueue.add(latch);
-            
+
             // Work the allocation queue, allocating idle instances and
             // instance creation permits in request arrival order
             allocate();
@@ -958,7 +958,7 @@
             synchronized (this) {
                 assertOpen();
             }
-                
+
             // If no object was allocated from the pool above
             if(latch.getPair() == null) {
                 // check if we were allowed to create one
@@ -982,7 +982,7 @@
                                         latch.wait();
                                     } else {
                                         // this code may be executed again after a notify then continue cycle
-                                        // so, need to calculate the amount of time to wait
+                                        // so, need to calculate the amount of time to wai
                                         final long elapsed = (System.currentTimeMillis() - starttime);
                                         final long waitTime = maxWait - elapsed;
                                         if (waitTime > 0)
@@ -993,7 +993,7 @@
                                 }
                             } catch(InterruptedException e) {
                                 Thread.currentThread().interrupt();
-                                throw e; 
+                                throw e;
                             }
                             if(maxWait > 0 && ((System.currentTimeMillis() - starttime) >= maxWait)) {
                                 throw new NoSuchElementException("Timeout waiting for idle object");
@@ -1023,7 +1023,7 @@
                     }
                 }
             }
-            // activate & validate the object
+            // activate & validate the objec
             try {
                 _factory.activateObject(latch.getPair().value);
                 if(_testOnBorrow &&
@@ -1041,7 +1041,7 @@
                 try {
                     _factory.destroyObject(latch.getPair().value);
                 } catch (Throwable e2) {
-                    // cannot destroy broken object
+                    // cannot destroy broken objec
                 }
                 synchronized (this) {
                     _numInternalProcessing--;
@@ -1114,7 +1114,7 @@
      */
     public void clear() {
         List toDestroy = new ArrayList();
-        
+
         synchronized(this) {
             toDestroy.addAll(_pool);
             _numInternalProcessing = _numInternalProcessing + _pool._size;
@@ -1132,7 +1132,7 @@
             try {
                 _factory.destroyObject(((ObjectTimestampPair)(it.next())).value);
             } catch(Exception e) {
-                // ignore error, keep destroying the rest
+                // ignore error, keep destroying the res
             } finally {
                 synchronized(this) {
                     _numInternalProcessing--;
@@ -1162,12 +1162,12 @@
 
     /**
      * {@inheritDoc}
-     * <p><strong>Note: </strong> There is no guard to prevent an object
+     * <p><strong>Note: </strong> There is no guard to prevent an objec
      * being returned to the pool multiple times. Clients are expected to
-     * discard references to returned objects and ensure that an object is not
+     * discard references to returned objects and ensure that an object is no
      * returned to the pool multiple times in sequence (i.e., without being
      * borrowed again between returns). Violating this contract will result in
-     * the same object appearing multiple times in the pool and pool counters 
+     * the same object appearing multiple times in the pool and pool counters
      * (numActive, numIdle) returning incorrect values.</p>
      */
     public void returnObject(Object obj) throws Exception {
@@ -1181,7 +1181,7 @@
                     // swallowed
                 }
                 // TODO: Correctness here depends on control in addObjectToPool.
-                // These two methods should be refactored, removing the 
+                // These two methods should be refactored, removing the
                 // "behavior flag",decrementNumActive, from addObjectToPool.
                 synchronized(this) {
                     _numActive--;
@@ -1225,7 +1225,7 @@
             }
         }
 
-        // Destroy the instance if necessary 
+        // Destroy the instance if necessary
         if(shouldDestroy) {
             try {
                 _factory.destroyObject(obj);
@@ -1240,7 +1240,7 @@
                 }
             }
         }
-        
+
     }
 
     public void close() throws Exception {
@@ -1278,13 +1278,13 @@
 
     /**
      * <p>Perform <code>numTests</code> idle object eviction tests, evicting
-     * examined objects that meet the criteria for eviction. If 
+     * examined objects that meet the criteria for eviction. If
      * <code>testWhileIdle</code> is true, examined objects are validated
-     * when visited (and removed if invalid); otherwise only objects that
+     * when visited (and removed if invalid); otherwise only objects tha
      * have been idle for more than <code>minEvicableIdletimeMillis</code>
      * are removed.</p>
-     * 
-     * <p>Successive activations of this method examine objects in 
+     *
+     * <p>Successive activations of this method examine objects in
      * in sequence, cycling through objects in oldest-to-youngest order.</p>
      *
      * @throws Exception if the pool is closed or eviction fails.
@@ -1297,26 +1297,26 @@
             }
             if (null == _evictionCursor) {
                 _evictionCursor = (_pool.cursor(_lifo ? _pool.size() : 0));
-            }  
+            }
         }
 
         for (int i=0,m=getNumTests();i<m;i++) {
             final ObjectTimestampPair pair;
             synchronized (this) {
-                if ((_lifo && !_evictionCursor.hasPrevious()) || 
+                if ((_lifo && !_evictionCursor.hasPrevious()) ||
                         !_lifo && !_evictionCursor.hasNext()) {
                     _evictionCursor.close();
                     _evictionCursor = _pool.cursor(_lifo ? _pool.size() : 0);
                 }
-                
-                pair = _lifo ? 
-                        (ObjectTimestampPair) _evictionCursor.previous() : 
+
+                pair = _lifo ?
+                        (ObjectTimestampPair) _evictionCursor.previous() :
                         (ObjectTimestampPair) _evictionCursor.next();
-                
+
                 _evictionCursor.remove();
                 _numInternalProcessing++;
             }
-                        
+
             boolean removeObject = false;
             final long idleTimeMilis = System.currentTimeMillis() - pair.tstamp;
             if ((getMinEvictableIdleTimeMillis() > 0)
@@ -1347,7 +1347,7 @@
                     }
                 }
             }
-            
+
             if (removeObject) {
                 try {
                     _factory.destroyObject(pair.value);
@@ -1359,7 +1359,7 @@
                 if(!removeObject) {
                     _evictionCursor.add(pair);
                     if (_lifo) {
-                        // Skip over the element we just added back 
+                        // Skip over the element we just added back
                         _evictionCursor.previous();
                     }
                 }
@@ -1433,7 +1433,7 @@
 
     /**
      * Start the eviction thread or service, or when
-     * <i>delay</i> is non-positive, stop it
+     * <i>delay</i> is non-positive, stop i
      * if it is already running.
      *
      * @param delay milliseconds between evictor runs.
@@ -1516,7 +1516,7 @@
          */
         public int maxActive = GenericObjectPool.DEFAULT_MAX_ACTIVE;
         /**
-         * @see GenericObjectPool#setMaxWait
+         * @see GenericObjectPool#setMaxWai
          */
         public long maxWait = GenericObjectPool.DEFAULT_MAX_WAIT;
         /**
@@ -1555,25 +1555,25 @@
          * @see GenericObjectPool#setLifo
          */
         public boolean lifo = GenericObjectPool.DEFAULT_LIFO;
-    
+
     }
 
     /**
      * Latch used to control allocation order of objects to threads to ensure
-     * fairness. That is, objects are allocated to threads in the order that
+     * fairness. That is, objects are allocated to threads in the order tha
      * threads request objects.
      */
     private static final class Latch {
         private ObjectTimestampPair _pair;
         private boolean _mayCreate = false;
-        
+
         private synchronized ObjectTimestampPair getPair() {
             return _pair;
         }
         private synchronized void setPair(ObjectTimestampPair pair) {
             _pair = pair;
         }
-        
+
         private synchronized boolean mayCreate() {
             return _mayCreate;
         }
@@ -1583,7 +1583,7 @@
 
         /**
          * Reset the latch data. Used when an allocation fails and the latch
-         * needs to be re-added to the queue. 
+         * needs to be re-added to the queue.
          */
         private synchronized void reset() {
             _pair = null;
@@ -1625,8 +1625,8 @@
      * When less than or equal to 0, the {@link #borrowObject} method
      * may block indefinitely.
      *
-     * @see #setMaxWait
-     * @see #getMaxWait
+     * @see #setMaxWai
+     * @see #getMaxWai
      * @see #WHEN_EXHAUSTED_BLOCK
      * @see #setWhenExhaustedAction
      * @see #getWhenExhaustedAction
@@ -1652,7 +1652,7 @@
      * {@link PoolableObjectFactory#validateObject validated}
      * before being returned by the {@link #borrowObject}
      * method.  If the object fails to validate,
-     * it will be dropped from the pool, and we will attempt
+     * it will be dropped from the pool, and we will attemp
      * to borrow another.
      *
      * @see #setTestOnBorrow
@@ -1674,7 +1674,7 @@
     /**
      * When <tt>true</tt>, objects will be
      * {@link PoolableObjectFactory#validateObject validated}
-     * by the idle object evictor (if any).  If an object
+     * by the idle object evictor (if any).  If an objec
      * fails to validate, it will be dropped from the pool.
      *
      * @see #setTestWhileIdle
@@ -1727,7 +1727,7 @@
     /**
      * The minimum amount of time an object may sit idle in the pool
      * before it is eligible for eviction by the idle object evictor
-     * (if any), with the extra condition that at least
+     * (if any), with the extra condition that at leas
      * "minIdle" amount of object remain in the pool.
      * When non-positive, no objects will be evicted from the pool
      * due to idle time alone.
@@ -1739,10 +1739,10 @@
 
     /** Whether or not the pool behaves as a LIFO queue (last in first out) */
     private boolean _lifo = DEFAULT_LIFO;
-    
+
     /** My pool. */
     private CursorableLinkedList _pool = null;
-    
+
     /** Eviction cursor - keeps track of idle object evictor position */
     private CursorableLinkedList.Cursor _evictionCursor = null;
 

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPoolFactory.java?rev=777065&r1=777064&r2=777065&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPoolFactory.java Thu May 21 11:12:58 2009
@@ -4,10 +4,10 @@
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
+ * the License.  You may obtain a copy of the License a
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -142,7 +142,7 @@
     public GenericObjectPoolFactory(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) {
         this(factory,maxActive,whenExhaustedAction,maxWait,maxIdle,GenericObjectPool.DEFAULT_MIN_IDLE,testOnBorrow,testOnReturn,timeBetweenEvictionRunsMillis,numTestsPerEvictionRun,minEvictableIdleTimeMillis,testWhileIdle, GenericObjectPool.DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS);
     }
-    
+
     /**
      * Create a new GenericObjectPoolFactory.
      *
@@ -186,7 +186,7 @@
     public GenericObjectPoolFactory(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, long softMinEvictableIdleTimeMillis) {
         this(factory,maxActive,whenExhaustedAction,maxWait,maxIdle,minIdle,testOnBorrow,testOnReturn,timeBetweenEvictionRunsMillis,numTestsPerEvictionRun,minEvictableIdleTimeMillis,testWhileIdle,softMinEvictableIdleTimeMillis, GenericObjectPool.DEFAULT_LIFO);
     }
-    
+
     /**
      * Create a new GenericObjectPoolFactory.
      *

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java?rev=777065&r1=777064&r2=777065&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java Thu May 21 11:12:58 2009
@@ -4,10 +4,10 @@
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
+ * the License.  You may obtain a copy of the License a
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -224,7 +224,7 @@
                         _factory.destroyObject(obj);
                     }
                 } catch(Exception e) {
-                    // ignore error, keep destroying the rest
+                    // ignore error, keep destroying the res
                 }
             }
         }

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java?rev=777065&r1=777064&r2=777065&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java Thu May 21 11:12:58 2009
@@ -4,10 +4,10 @@
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
+ * the License.  You may obtain a copy of the License a
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -166,7 +166,7 @@
                         // swallowed
                     } finally {
                         obj = null;
-                    } 
+                    }
                     if (newlyMade) {
                         throw new NoSuchElementException(
                             "Could not create a validated object, cause: " +
@@ -377,7 +377,7 @@
                     try {
                         _factory.destroyObject(key,it.next());
                     } catch(Exception e) {
-                        // ignore error, keep destroying the rest
+                        // ignore error, keep destroying the res
                     }
                 }
             }
@@ -446,7 +446,7 @@
     private void incrementActiveCount(Object key) {
         _totActive++;
         Integer old = (Integer)(_activeCount.get(key));
-        if(null == old) { 
+        if(null == old) {
             _activeCount.put(key,new Integer(1));
         } else {
             _activeCount.put(key,new Integer(old.intValue() + 1));
@@ -470,7 +470,7 @@
 
     /**
      * The default initial size of the pool
-     * (this specifies the size of the container, it does not
+     * (this specifies the size of the container, it does no
      * cause the pool to be pre-populated.)
      */
     protected static final int DEFAULT_INIT_SLEEPING_CAPACITY = 4;

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPoolFactory.java?rev=777065&r1=777064&r2=777065&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPoolFactory.java Thu May 21 11:12:58 2009
@@ -4,10 +4,10 @@
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
+ * the License.  You may obtain a copy of the License a
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java?rev=777065&r1=777064&r2=777065&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java Thu May 21 11:12:58 2009
@@ -4,10 +4,10 @@
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
+ * the License.  You may obtain a copy of the License a
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -166,7 +166,7 @@
                         // swallowed
                     } finally {
                         obj = null;
-                    } 
+                    }
                     if (newlyCreated) {
                         throw new NoSuchElementException(
                             "Could not create a validated object, cause: " +
@@ -200,7 +200,7 @@
             Object toBeDestroyed = null;
             if(_pool.size() >= _maxSleeping) {
                 shouldDestroy = true;
-                toBeDestroyed = _pool.remove(0); // remove the stalest object
+                toBeDestroyed = _pool.remove(0); // remove the stalest objec
             }
             _pool.push(obj);
             obj = toBeDestroyed; // swap returned obj with the stalest one so it can be destroyed
@@ -253,7 +253,7 @@
                 try {
                     _factory.destroyObject(it.next());
                 } catch(Exception e) {
-                    // ignore error, keep destroying the rest
+                    // ignore error, keep destroying the res
                 }
             }
         }
@@ -300,7 +300,7 @@
             Object toBeDestroyed = null;
             if(_pool.size() >= _maxSleeping) {
                 shouldDestroy = true;
-                toBeDestroyed = _pool.remove(0); // remove the stalest object
+                toBeDestroyed = _pool.remove(0); // remove the stalest objec
             }
             _pool.push(obj);
             obj = toBeDestroyed; // swap returned obj with the stalest one so it can be destroyed
@@ -340,7 +340,7 @@
 
     /**
      * The default initial size of the pool
-     * (this specifies the size of the container, it does not
+     * (this specifies the size of the container, it does no
      * cause the pool to be pre-populated.)
      */
     protected static final int DEFAULT_INIT_SLEEPING_CAPACITY = 4;

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPoolFactory.java?rev=777065&r1=777064&r2=777065&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPoolFactory.java Thu May 21 11:12:58 2009
@@ -4,10 +4,10 @@
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
+ * the License.  You may obtain a copy of the License a
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@
 public class StackObjectPoolFactory implements ObjectPoolFactory {
     /**
      * Create a new StackObjectPoolFactory.
-     * 
+     *
      * @see StackObjectPool#StackObjectPool()
      */
     public StackObjectPoolFactory() {

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/package.html
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/package.html?rev=777065&r1=777064&r2=777065&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/package.html (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/package.html Thu May 21 11:12:58 2009
@@ -4,7 +4,7 @@
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
- the License.  You may obtain a copy of the License at
+ the License.  You may obtain a copy of the License a
 
       http://www.apache.org/licenses/LICENSE-2.0
 

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/overview.html
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/overview.html?rev=777065&r1=777064&r2=777065&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/overview.html (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/overview.html Thu May 21 11:12:58 2009
@@ -4,7 +4,7 @@
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
- the License.  You may obtain a copy of the License at
+ the License.  You may obtain a copy of the License a
 
       http://www.apache.org/licenses/LICENSE-2.0
 
@@ -24,51 +24,51 @@
          Generic Object pooling API with several implementations.
       </p>
       <p>
-         The <code>org.apache.commons.pool</code> package defines a simple 
-         interface for a pool of object instances, and a handful of base 
+         The <code>org.apache.commons.pool</code> package defines a simple
+         interface for a pool of object instances, and a handful of base
          classes that may be useful when creating pool implementations.
          The API supports pooling of unique objects which can be requested
          via a key as well as pools where all objects are equivalent.
       </p>
       <p>
          The <code>org.apache.commons.pool.impl</code> package contains
-         several pool implementations.  
+         several pool implementations.
          {@link org.apache.commons.pool.impl.StackObjectPool StackObjectPool}
          is useful for supporting reuse of a limited number of instances while
          allowing new instances to be created as needed to support high demand.
-         {@link org.apache.commons.pool.impl.GenericObjectPool 
-         GenericObjectPool} has many configuration options and can support
+         {@link org.apache.commons.pool.impl.GenericObjectPool
+         GenericObjectPool} has many configuration options and can suppor
          a limited set of objects such as would be useful in a database
          connection pool.
-         {@link org.apache.commons.pool.impl.SoftReferenceObjectPool 
+         {@link org.apache.commons.pool.impl.SoftReferenceObjectPool
          SoftReferenceObjectPool} has no limit on the number of objects in the
          pool, but the garbage collector can remove idle objects from the pool
          as needed.  There are also keyed versions of the first two.
       </p>
       <p>
-         Here is a simple example of pooling <code>HashMap</code>'s. First 
-         create an {@link org.apache.commons.pool.ObjectPoolFactory 
+         Here is a simple example of pooling <code>HashMap</code>'s. Firs
+         create an {@link org.apache.commons.pool.ObjectPoolFactory
          ObjectPoolFactory}
       </p>
 <pre>
-    public class HashMapFactory 
+    public class HashMapFactory
         extends {@link org.apache.commons.pool.BasePoolableObjectFactory BasePoolableObjectFactory}
     {
         /**
          * Creates an instance that can be returned by the pool.
          * @return an instance that can be returned by the pool.
          */
-        public Object makeObject() 
+        public Object makeObject()
             throws Exception
         {
             return new HashMap();
         }
-        
+
         /**
          * Uninitialize an instance to be returned to the pool.
          * @param obj the instance to be passivated
          */
-        public void passivateObject(Object obj) 
+        public void passivateObject(Object obj)
             throws Exception
         {
             Map map = (Map)obj;
@@ -113,9 +113,9 @@
 </pre>
 
 <p>
-The above example shows how one would use an 
-{@link org.apache.commons.pool.ObjectPool ObjectPool}.  The other supplied 
+The above example shows how one would use an
+{@link org.apache.commons.pool.ObjectPool ObjectPool}.  The other supplied
 implementations or another special purpose pool would be used similarly.
 </p>
    </body>
-</html>
\ No newline at end of file
+</html>

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/package.html
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/package.html?rev=777065&r1=777064&r2=777065&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/package.html (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/package.html Thu May 21 11:12:58 2009
@@ -4,7 +4,7 @@
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
- the License.  You may obtain a copy of the License at
+ the License.  You may obtain a copy of the License a
 
       http://www.apache.org/licenses/LICENSE-2.0
 
@@ -24,33 +24,33 @@
          Object pooling API.
       </p>
       <p>
-         The <code>org.apache.commons.pool</code> package defines a simple 
-         interface for a pool of object instances, and a handful of base 
+         The <code>org.apache.commons.pool</code> package defines a simple
+         interface for a pool of object instances, and a handful of base
          classes that may be useful when creating pool implementations.
       </p>
       <p>
-         The <code>pool</code> package itself doesn't define a specific object
+         The <code>pool</code> package itself doesn't define a specific objec
          pooling implementation, but rather a contract that implementations may
-         support in order to be fully interchangeable.         
+         support in order to be fully interchangeable.
       </p>
       <p>
          The <code>pool</code> package separates the way in which instances are
-         pooled from the way in which they are created, resulting in a pair of 
+         pooled from the way in which they are created, resulting in a pair of
          interfaces:
       </p>
       <dl>
         <dt>{@link org.apache.commons.pool.ObjectPool ObjectPool}</dt>
         <dd>
-          defines a simple object pooling interface, with methods for 
+          defines a simple object pooling interface, with methods for
           borrowing instances from and returning them to the pool.
         </dd>
         <dt>{@link org.apache.commons.pool.PoolableObjectFactory PoolableObjectFactory}</dt>
         <dd>
           defines lifecycle methods for object instances contained within a pool.
-          By associating a factory with a pool, the pool can create new object
+          By associating a factory with a pool, the pool can create new objec
           instances as needed.
         </dd>
-      </dl>        
+      </dl>
       <p>
         {@link org.apache.commons.pool.ObjectPoolFactory ObjectPoolFactory}
         defines a simple factory for <code>ObjectPool</code>s, which may be
@@ -58,11 +58,11 @@
       </p>
       <p>
          The <code>pool</code> package also provides a keyed pool interface,
-         which pools instances of multiple types, accessed according to an 
+         which pools instances of multiple types, accessed according to an
          arbitrary key. See
          {@link org.apache.commons.pool.KeyedObjectPool KeyedObjectPool},
          {@link org.apache.commons.pool.KeyedPoolableObjectFactory KeyedPoolableObjectFactory},
-         and 
+         and
          {@link org.apache.commons.pool.KeyedObjectPoolFactory KeyedObjectPoolFactory}.
       </p>
    </body>



Re: svn commit: r777065 [2/2] - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool: ./ impl/

Posted by Phil Steitz <ph...@gmail.com>.
sebb wrote:
> On 21/05/2009, Rainer Jung <ra...@kippdata.de> wrote:
>   
>> On 21.05.2009 13:12, psteitz@apache.org wrote:
>>  > Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
>>  > URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=777065&r1=777064&r2=777065&view=diff
>>  > ==============================================================================
>>  > --- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java (original)
>>  > +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java Thu May 21 11:12:58 2009
>>  > @@ -4,10 +4,10 @@
>>
>> ...
>>
>>     
>>> - * the License.  You may obtain a copy of the License at
>>>       
>>  > + * the License.  You may obtain a copy of the License a
>>
>> ...
>>
>>     
>>> - *    limit to the number of objects that may be idle at one time. The default
>>>       
>>  > + *    limit to the number of objects that may be idle at one time. The defaul
>>
>>
>> Caution: It seems your script removed trailing characters "t" also,
>>  maybe some misinterpretation of "\t".
>>     
>
> Thanks for the warning.
>   
++1 Aaaargh!
> Now fixed in SVN.
>   

Thanks!
>   
>>  Regards,
>>
>>  Rainer
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>   


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


Re: svn commit: r777065 [2/2] - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool: ./ impl/

Posted by sebb <se...@gmail.com>.
On 21/05/2009, Rainer Jung <ra...@kippdata.de> wrote:
> On 21.05.2009 13:12, psteitz@apache.org wrote:
>  > Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
>  > URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=777065&r1=777064&r2=777065&view=diff
>  > ==============================================================================
>  > --- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java (original)
>  > +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java Thu May 21 11:12:58 2009
>  > @@ -4,10 +4,10 @@
>
> ...
>
> > - * the License.  You may obtain a copy of the License at
>  > + * the License.  You may obtain a copy of the License a
>
> ...
>
> > - *    limit to the number of objects that may be idle at one time. The default
>  > + *    limit to the number of objects that may be idle at one time. The defaul
>
>
> Caution: It seems your script removed trailing characters "t" also,
>  maybe some misinterpretation of "\t".

Thanks for the warning.

Now fixed in SVN.

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

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


Re: svn commit: r777065 [2/2] - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool: ./ impl/

Posted by Rainer Jung <ra...@kippdata.de>.
On 21.05.2009 13:12, psteitz@apache.org wrote:
> Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
> URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=777065&r1=777064&r2=777065&view=diff
> ==============================================================================
> --- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java (original)
> +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java Thu May 21 11:12:58 2009
> @@ -4,10 +4,10 @@
...
> - * the License.  You may obtain a copy of the License at
> + * the License.  You may obtain a copy of the License a
...
> - *    limit to the number of objects that may be idle at one time. The default
> + *    limit to the number of objects that may be idle at one time. The defaul

Caution: It seems your script removed trailing characters "t" also,
maybe some misinterpretation of "\t".

Regards,

Rainer

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