You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/05/13 18:50:09 UTC

svn commit: r1743721 [3/3] - in /tomcat/tc8.5.x/trunk: ./ java/org/apache/tomcat/dbcp/pool2/ java/org/apache/tomcat/dbcp/pool2/impl/ webapps/docs/

Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/LinkedBlockingDeque.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/LinkedBlockingDeque.java?rev=1743721&r1=1743720&r2=1743721&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/LinkedBlockingDeque.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/LinkedBlockingDeque.java Fri May 13 18:50:08 2016
@@ -118,7 +118,7 @@ class LinkedBlockingDeque<E> extends Abs
          * @param p Previous item
          * @param n Next item
          */
-        Node(E x, Node<E> p, Node<E> n) {
+        Node(final E x, final Node<E> p, final Node<E> n) {
             item = x;
             prev = p;
             next = n;
@@ -168,7 +168,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @param fairness true means threads waiting on the deque should be served
      * as if waiting in a FIFO request queue
      */
-    public LinkedBlockingDeque(boolean fairness) {
+    public LinkedBlockingDeque(final boolean fairness) {
         this(Integer.MAX_VALUE, fairness);
     }
 
@@ -178,7 +178,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @param capacity the capacity of this deque
      * @throws IllegalArgumentException if {@code capacity} is less than 1
      */
-    public LinkedBlockingDeque(int capacity) {
+    public LinkedBlockingDeque(final int capacity) {
         this(capacity, false);
     }
 
@@ -191,7 +191,7 @@ class LinkedBlockingDeque<E> extends Abs
      * as if waiting in a FIFO request queue
      * @throws IllegalArgumentException if {@code capacity} is less than 1
      */
-    public LinkedBlockingDeque(int capacity, boolean fairness) {
+    public LinkedBlockingDeque(final int capacity, final boolean fairness) {
         if (capacity <= 0) {
             throw new IllegalArgumentException();
         }
@@ -211,11 +211,11 @@ class LinkedBlockingDeque<E> extends Abs
      * @throws NullPointerException if the specified collection or any
      *         of its elements are null
      */
-    public LinkedBlockingDeque(Collection<? extends E> c) {
+    public LinkedBlockingDeque(final Collection<? extends E> c) {
         this(Integer.MAX_VALUE);
         lock.lock(); // Never contended, but necessary for visibility
         try {
-            for (E e : c) {
+            for (final E e : c) {
                 if (e == null) {
                     throw new NullPointerException();
                 }
@@ -238,13 +238,13 @@ class LinkedBlockingDeque<E> extends Abs
      *
      * @return {@code true} if successful, otherwise {@code false}
      */
-    private boolean linkFirst(E e) {
+    private boolean linkFirst(final E e) {
         // assert lock.isHeldByCurrentThread();
         if (count >= capacity) {
             return false;
         }
-        Node<E> f = first;
-        Node<E> x = new Node<>(e, null, f);
+        final Node<E> f = first;
+        final Node<E> x = new Node<>(e, null, f);
         first = x;
         if (last == null) {
             last = x;
@@ -263,13 +263,13 @@ class LinkedBlockingDeque<E> extends Abs
      *
      * @return {@code true} if successful, otherwise {@code false}
      */
-    private boolean linkLast(E e) {
+    private boolean linkLast(final E e) {
         // assert lock.isHeldByCurrentThread();
         if (count >= capacity) {
             return false;
         }
-        Node<E> l = last;
-        Node<E> x = new Node<>(e, l, null);
+        final Node<E> l = last;
+        final Node<E> x = new Node<>(e, l, null);
         last = x;
         if (first == null) {
             first = x;
@@ -288,12 +288,12 @@ class LinkedBlockingDeque<E> extends Abs
      */
     private E unlinkFirst() {
         // assert lock.isHeldByCurrentThread();
-        Node<E> f = first;
+        final Node<E> f = first;
         if (f == null) {
             return null;
         }
-        Node<E> n = f.next;
-        E item = f.item;
+        final Node<E> n = f.next;
+        final E item = f.item;
         f.item = null;
         f.next = f; // help GC
         first = n;
@@ -314,12 +314,12 @@ class LinkedBlockingDeque<E> extends Abs
      */
     private E unlinkLast() {
         // assert lock.isHeldByCurrentThread();
-        Node<E> l = last;
+        final Node<E> l = last;
         if (l == null) {
             return null;
         }
-        Node<E> p = l.prev;
-        E item = l.item;
+        final Node<E> p = l.prev;
+        final E item = l.item;
         l.item = null;
         l.prev = l; // help GC
         last = p;
@@ -338,10 +338,10 @@ class LinkedBlockingDeque<E> extends Abs
      *
      * @param x The node to unlink
      */
-    private void unlink(Node<E> x) {
+    private void unlink(final Node<E> x) {
         // assert lock.isHeldByCurrentThread();
-        Node<E> p = x.prev;
-        Node<E> n = x.next;
+        final Node<E> p = x.prev;
+        final Node<E> n = x.next;
         if (p == null) {
             unlinkFirst();
         } else if (n == null) {
@@ -363,7 +363,7 @@ class LinkedBlockingDeque<E> extends Abs
      * {@inheritDoc}
      */
     @Override
-    public void addFirst(E e) {
+    public void addFirst(final E e) {
         if (!offerFirst(e)) {
             throw new IllegalStateException("Deque full");
         }
@@ -373,7 +373,7 @@ class LinkedBlockingDeque<E> extends Abs
      * {@inheritDoc}
      */
     @Override
-    public void addLast(E e) {
+    public void addLast(final E e) {
         if (!offerLast(e)) {
             throw new IllegalStateException("Deque full");
         }
@@ -383,7 +383,7 @@ class LinkedBlockingDeque<E> extends Abs
      * {@inheritDoc}
      */
     @Override
-    public boolean offerFirst(E e) {
+    public boolean offerFirst(final E e) {
         if (e == null) {
             throw new NullPointerException();
         }
@@ -399,7 +399,7 @@ class LinkedBlockingDeque<E> extends Abs
      * {@inheritDoc}
      */
     @Override
-    public boolean offerLast(E e) {
+    public boolean offerLast(final E e) {
         if (e == null) {
             throw new NullPointerException();
         }
@@ -421,7 +421,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public void putFirst(E e) throws InterruptedException {
+    public void putFirst(final E e) throws InterruptedException {
         if (e == null) {
             throw new NullPointerException();
         }
@@ -445,7 +445,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public void putLast(E e) throws InterruptedException {
+    public void putLast(final E e) throws InterruptedException {
         if (e == null) {
             throw new NullPointerException();
         }
@@ -473,7 +473,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public boolean offerFirst(E e, long timeout, TimeUnit unit)
+    public boolean offerFirst(final E e, final long timeout, final TimeUnit unit)
         throws InterruptedException {
         if (e == null) {
             throw new NullPointerException();
@@ -507,7 +507,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @throws InterruptedException if the thread is interrupted whist waiting
      *         for space
      */
-    public boolean offerLast(E e, long timeout, TimeUnit unit)
+    public boolean offerLast(final E e, final long timeout, final TimeUnit unit)
         throws InterruptedException {
         if (e == null) {
             throw new NullPointerException();
@@ -532,7 +532,7 @@ class LinkedBlockingDeque<E> extends Abs
      */
     @Override
     public E removeFirst() {
-        E x = pollFirst();
+        final E x = pollFirst();
         if (x == null) {
             throw new NoSuchElementException();
         }
@@ -544,7 +544,7 @@ class LinkedBlockingDeque<E> extends Abs
      */
     @Override
     public E removeLast() {
-        E x = pollLast();
+        final E x = pollLast();
         if (x == null) {
             throw new NoSuchElementException();
         }
@@ -621,7 +621,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @return the unlinked element
      * @throws InterruptedException if the current thread is interrupted
      */
-    public E pollFirst(long timeout, TimeUnit unit)
+    public E pollFirst(final long timeout, final TimeUnit unit)
         throws InterruptedException {
         long nanos = unit.toNanos(timeout);
         lock.lockInterruptibly();
@@ -649,7 +649,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @return the unlinked element
      * @throws InterruptedException if the current thread is interrupted
      */
-    public E pollLast(long timeout, TimeUnit unit)
+    public E pollLast(final long timeout, final TimeUnit unit)
         throws InterruptedException {
         long nanos = unit.toNanos(timeout);
         lock.lockInterruptibly();
@@ -672,7 +672,7 @@ class LinkedBlockingDeque<E> extends Abs
      */
     @Override
     public E getFirst() {
-        E x = peekFirst();
+        final E x = peekFirst();
         if (x == null) {
             throw new NoSuchElementException();
         }
@@ -684,7 +684,7 @@ class LinkedBlockingDeque<E> extends Abs
      */
     @Override
     public E getLast() {
-        E x = peekLast();
+        final E x = peekLast();
         if (x == null) {
             throw new NoSuchElementException();
         }
@@ -712,7 +712,7 @@ class LinkedBlockingDeque<E> extends Abs
     }
 
     @Override
-    public boolean removeFirstOccurrence(Object o) {
+    public boolean removeFirstOccurrence(final Object o) {
         if (o == null) {
             return false;
         }
@@ -731,7 +731,7 @@ class LinkedBlockingDeque<E> extends Abs
     }
 
     @Override
-    public boolean removeLastOccurrence(Object o) {
+    public boolean removeLastOccurrence(final Object o) {
         if (o == null) {
             return false;
         }
@@ -755,7 +755,7 @@ class LinkedBlockingDeque<E> extends Abs
      * {@inheritDoc}
      */
     @Override
-    public boolean add(E e) {
+    public boolean add(final E e) {
         addLast(e);
         return true;
     }
@@ -764,7 +764,7 @@ class LinkedBlockingDeque<E> extends Abs
      * {@inheritDoc}
      */
     @Override
-    public boolean offer(E e) {
+    public boolean offer(final E e) {
         return offerLast(e);
     }
 
@@ -780,7 +780,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public void put(E e) throws InterruptedException {
+    public void put(final E e) throws InterruptedException {
         putLast(e);
     }
 
@@ -800,7 +800,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public boolean offer(E e, long timeout, TimeUnit unit)
+    public boolean offer(final E e, final long timeout, final TimeUnit unit)
         throws InterruptedException {
         return offerLast(e, timeout, unit);
     }
@@ -850,7 +850,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @return the unlinked element
      * @throws InterruptedException if the current thread is interrupted
      */
-    public E poll(long timeout, TimeUnit unit) throws InterruptedException {
+    public E poll(final long timeout, final TimeUnit unit) throws InterruptedException {
         return pollFirst(timeout, unit);
     }
 
@@ -911,7 +911,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @throws NullPointerException if c is null
      * @throws IllegalArgumentException if c is this instance
      */
-    public int drainTo(Collection<? super E> c) {
+    public int drainTo(final Collection<? super E> c) {
         return drainTo(c, Integer.MAX_VALUE);
     }
 
@@ -931,7 +931,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @throws NullPointerException if c is null
      * @throws IllegalArgumentException if c is this instance
      */
-    public int drainTo(Collection<? super E> c, int maxElements) {
+    public int drainTo(final Collection<? super E> c, final int maxElements) {
         if (c == null) {
             throw new NullPointerException();
         }
@@ -940,7 +940,7 @@ class LinkedBlockingDeque<E> extends Abs
         }
         lock.lock();
         try {
-            int n = Math.min(maxElements, count);
+            final int n = Math.min(maxElements, count);
             for (int i = 0; i < n; i++) {
                 c.add(first.item);   // In this order, in case add() throws.
                 unlinkFirst();
@@ -957,7 +957,7 @@ class LinkedBlockingDeque<E> extends Abs
      * {@inheritDoc}
      */
     @Override
-    public void push(E e) {
+    public void push(final E e) {
         addFirst(e);
     }
 
@@ -986,7 +986,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @return {@code true} if this deque changed as a result of the call
      */
     @Override
-    public boolean remove(Object o) {
+    public boolean remove(final Object o) {
         return removeFirstOccurrence(o);
     }
 
@@ -1014,7 +1014,7 @@ class LinkedBlockingDeque<E> extends Abs
      * @return {@code true} if this deque contains the specified element
      */
     @Override
-    public boolean contains(Object o) {
+    public boolean contains(final Object o) {
         if (o == null) {
             return false;
         }
@@ -1089,7 +1089,7 @@ class LinkedBlockingDeque<E> extends Abs
     public Object[] toArray() {
         lock.lock();
         try {
-            Object[] a = new Object[count];
+            final Object[] a = new Object[count];
             int k = 0;
             for (Node<E> p = first; p != null; p = p.next) {
                 a[k++] = p.item;
@@ -1145,7 +1145,7 @@ class LinkedBlockingDeque<E> extends Abs
         try {
             for (Node<E> f = first; f != null;) {
                 f.item = null;
-                Node<E> n = f.next;
+                final Node<E> n = f.next;
                 f.prev = null;
                 f.next = null;
                 f = n;
@@ -1248,15 +1248,16 @@ class LinkedBlockingDeque<E> extends Abs
             // Chains of deleted nodes ending in null or self-links
             // are possible if multiple interior nodes are removed.
             for (;;) {
-                Node<E> s = nextNode(n);
-                if (s == null)
+                final Node<E> s = nextNode(n);
+                if (s == null) {
                     return null;
-                else if (s.item != null)
+                } else if (s.item != null) {
                     return s;
-                else if (s == n)
+                } else if (s == n) {
                     return firstNode();
-                else
+                } else {
                     n = s;
+                }
             }
         }
 
@@ -1285,14 +1286,14 @@ class LinkedBlockingDeque<E> extends Abs
                 throw new NoSuchElementException();
             }
             lastRet = next;
-            E x = nextItem;
+            final E x = nextItem;
             advance();
             return x;
         }
 
         @Override
         public void remove() {
-            Node<E> n = lastRet;
+            final Node<E> n = lastRet;
             if (n == null) {
                 throw new IllegalStateException();
             }
@@ -1313,7 +1314,7 @@ class LinkedBlockingDeque<E> extends Abs
         @Override
         Node<E> firstNode() { return first; }
         @Override
-        Node<E> nextNode(Node<E> n) { return n.next; }
+        Node<E> nextNode(final Node<E> n) { return n.next; }
         }
 
     /** Descending iterator */
@@ -1321,7 +1322,7 @@ class LinkedBlockingDeque<E> extends Abs
         @Override
         Node<E> firstNode() { return last; }
         @Override
-        Node<E> nextNode(Node<E> n) { return n.prev; }
+        Node<E> nextNode(final Node<E> n) { return n.prev; }
     }
 
     /**
@@ -1331,7 +1332,7 @@ class LinkedBlockingDeque<E> extends Abs
      * {@code Object}) in the proper order, followed by a null
      * @param s the stream
      */
-    private void writeObject(java.io.ObjectOutputStream s)
+    private void writeObject(final java.io.ObjectOutputStream s)
         throws java.io.IOException {
         lock.lock();
         try {
@@ -1353,7 +1354,7 @@ class LinkedBlockingDeque<E> extends Abs
      * deserialize it).
      * @param s the stream
      */
-    private void readObject(java.io.ObjectInputStream s)
+    private void readObject(final java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
         s.defaultReadObject();
         count = 0;
@@ -1362,6 +1363,7 @@ class LinkedBlockingDeque<E> extends Abs
         // Read in all elements and place in queue
         for (;;) {
             @SuppressWarnings("unchecked")
+            final
             E item = (E)s.readObject();
             if (item == null) {
                 break;

Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/PoolImplUtils.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/PoolImplUtils.java?rev=1743721&r1=1743720&r2=1743721&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/PoolImplUtils.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/PoolImplUtils.java Fri May 13 18:50:08 2016
@@ -37,7 +37,7 @@ class PoolImplUtils {
      * @return the type of object the factory creates
      */
     @SuppressWarnings("rawtypes")
-    static Class<?> getFactoryType(Class<? extends PooledObjectFactory> factory) {
+    static Class<?> getFactoryType(final Class<? extends PooledObjectFactory> factory) {
         return (Class<?>) getGenericType(PooledObjectFactory.class, factory);
     }
 
@@ -52,17 +52,17 @@ class PoolImplUtils {
      *
      * @return concrete type used by the implementation
      */
-    private static <T> Object getGenericType(Class<T> type,
-            Class<? extends T> clazz) {
+    private static <T> Object getGenericType(final Class<T> type,
+            final Class<? extends T> clazz) {
 
         // Look to see if this class implements the generic interface
 
         // Get all the interfaces
-        Type[] interfaces = clazz.getGenericInterfaces();
-        for (Type iface : interfaces) {
+        final Type[] interfaces = clazz.getGenericInterfaces();
+        for (final Type iface : interfaces) {
             // Only need to check interfaces that use generics
             if (iface instanceof ParameterizedType) {
-                ParameterizedType pi = (ParameterizedType) iface;
+                final ParameterizedType pi = (ParameterizedType) iface;
                 // Look for the generic interface
                 if (pi.getRawType() instanceof Class) {
                     if (type.isAssignableFrom((Class<?>) pi.getRawType())) {
@@ -75,10 +75,11 @@ class PoolImplUtils {
 
         // Interface not found on this class. Look at the superclass.
         @SuppressWarnings("unchecked")
+        final
         Class<? extends T> superClazz =
                 (Class<? extends T>) clazz.getSuperclass();
 
-        Object result = getGenericType(type, superClazz);
+        final Object result = getGenericType(type, superClazz);
         if (result instanceof Class<?>) {
             // Superclass implements interface and defines explicit type for
             // generic
@@ -87,7 +88,7 @@ class PoolImplUtils {
             // Superclass implements interface and defines unknown type for
             // generic
             // Map that unknown type to the generic types defined in this class
-            ParameterizedType superClassType =
+            final ParameterizedType superClassType =
                     (ParameterizedType) clazz.getGenericSuperclass();
             return getTypeParameter(clazz,
                     superClassType.getActualTypeArguments()[
@@ -110,11 +111,11 @@ class PoolImplUtils {
      *         type parameter or an instance of {@link Integer} representing
      *         the index for the type in the definition of the defining class
      */
-    private static Object getTypeParameter(Class<?> clazz, Type argType) {
+    private static Object getTypeParameter(final Class<?> clazz, final Type argType) {
         if (argType instanceof Class<?>) {
             return argType;
         }
-        TypeVariable<?>[] tvs = clazz.getTypeParameters();
+        final TypeVariable<?>[] tvs = clazz.getTypeParameters();
         for (int i = 0; i < tvs.length; i++) {
             if (tvs[i].equals(argType)) {
                 return Integer.valueOf(i);

Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/PooledSoftReference.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/PooledSoftReference.java?rev=1743721&r1=1743720&r2=1743721&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/PooledSoftReference.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/PooledSoftReference.java Fri May 13 18:50:08 2016
@@ -38,7 +38,7 @@ public class PooledSoftReference<T> exte
      *
      * @param reference SoftReference to be managed by the pool
      */
-    public PooledSoftReference(SoftReference<T> reference) {
+    public PooledSoftReference(final SoftReference<T> reference) {
         super(null);  // Null the hard reference in the parent
         this.reference = reference;
     }
@@ -61,7 +61,7 @@ public class PooledSoftReference<T> exte
      */
     @Override
     public String toString() {
-        StringBuilder result = new StringBuilder();
+        final StringBuilder result = new StringBuilder();
         result.append("Referenced Object: ");
         result.append(getObject().toString());
         result.append(", State: ");
@@ -92,7 +92,7 @@ public class PooledSoftReference<T> exte
      *
      * @param reference new reference
      */
-    public synchronized void setReference(SoftReference<T> reference) {
+    public synchronized void setReference(final SoftReference<T> reference) {
         this.reference = reference;
     }
 }

Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/SoftReferenceObjectPool.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/SoftReferenceObjectPool.java?rev=1743721&r1=1743720&r2=1743721&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/SoftReferenceObjectPool.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/pool2/impl/SoftReferenceObjectPool.java Fri May 13 18:50:08 2016
@@ -72,7 +72,7 @@ public class SoftReferenceObjectPool<T>
      *
      * @param factory object factory to use.
      */
-    public SoftReferenceObjectPool(PooledObjectFactory<T> factory) {
+    public SoftReferenceObjectPool(final PooledObjectFactory<T> factory) {
         this.factory = factory;
     }
 
@@ -143,11 +143,11 @@ public class SoftReferenceObjectPool<T>
                     if (!factory.validateObject(ref)) {
                         throw new Exception("ValidateObject failed");
                     }
-                } catch (Throwable t) {
+                } catch (final Throwable t) {
                     PoolUtils.checkRethrow(t);
                     try {
                         destroy(ref);
-                    } catch (Throwable t2) {
+                    } catch (final Throwable t2) {
                         PoolUtils.checkRethrow(t2);
                         // Swallowed
                     } finally {
@@ -186,7 +186,7 @@ public class SoftReferenceObjectPool<T>
      *            instance to return to the pool
      */
     @Override
-    public synchronized void returnObject(T obj) throws Exception {
+    public synchronized void returnObject(final T obj) throws Exception {
         boolean success = !isClosed();
         final PooledSoftReference<T> ref = findReference(obj);
         if (ref == null) {
@@ -199,13 +199,13 @@ public class SoftReferenceObjectPool<T>
             } else {
                 try {
                     factory.passivateObject(ref);
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     success = false;
                 }
             }
         }
 
-        boolean shouldDestroy = !success;
+        final boolean shouldDestroy = !success;
         numActive--;
         if (success) {
 
@@ -218,7 +218,7 @@ public class SoftReferenceObjectPool<T>
         if (shouldDestroy && factory != null) {
             try {
                 destroy(ref);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 // ignored
             }
         }
@@ -228,7 +228,7 @@ public class SoftReferenceObjectPool<T>
      * {@inheritDoc}
      */
     @Override
-    public synchronized void invalidateObject(T obj) throws Exception {
+    public synchronized void invalidateObject(final T obj) throws Exception {
         final PooledSoftReference<T> ref = findReference(obj);
         if (ref == null) {
             throw new IllegalStateException(
@@ -270,10 +270,10 @@ public class SoftReferenceObjectPool<T>
             throw new IllegalStateException(
                     "Cannot add objects without a factory.");
         }
-        T obj = factory.makeObject().getObject();
+        final T obj = factory.makeObject().getObject();
         createCount++;
         // Create and register with the queue
-        PooledSoftReference<T> ref = new PooledSoftReference<>(
+        final PooledSoftReference<T> ref = new PooledSoftReference<>(
                 new SoftReference<>(obj, refQueue));
         allReferences.add(ref);
 
@@ -284,7 +284,7 @@ public class SoftReferenceObjectPool<T>
             factory.passivateObject(ref);
         }
 
-        boolean shouldDestroy = !success;
+        final boolean shouldDestroy = !success;
         if (success) {
             idleReferences.add(ref);
             notifyAll(); // numActive has changed
@@ -293,7 +293,7 @@ public class SoftReferenceObjectPool<T>
         if (shouldDestroy) {
             try {
                 destroy(ref);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 // ignored
             }
         }
@@ -327,14 +327,14 @@ public class SoftReferenceObjectPool<T>
     @Override
     public synchronized void clear() {
         if (null != factory) {
-            Iterator<PooledSoftReference<T>> iter = idleReferences.iterator();
+            final Iterator<PooledSoftReference<T>> iter = idleReferences.iterator();
             while (iter.hasNext()) {
                 try {
                     final PooledSoftReference<T> ref = iter.next();
                     if (null != ref.getObject()) {
                         factory.destroyObject(ref);
                     }
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     // ignore error, keep destroying the rest
                 }
             }
@@ -384,8 +384,8 @@ public class SoftReferenceObjectPool<T>
      * @param obj returning object
      * @return PooledSoftReference wrapping a soft reference to obj
      */
-    private PooledSoftReference<T> findReference(T obj) {
-        Iterator<PooledSoftReference<T>> iterator = allReferences.iterator();
+    private PooledSoftReference<T> findReference(final T obj) {
+        final Iterator<PooledSoftReference<T>> iterator = allReferences.iterator();
         while (iterator.hasNext()) {
             final PooledSoftReference<T> reference = iterator.next();
             if (reference.getObject() != null && reference.getObject().equals(obj)) {
@@ -403,7 +403,7 @@ public class SoftReferenceObjectPool<T>
      *
      * @throws Exception If an error occurs while trying to destroy the object
      */
-    private void destroy(PooledSoftReference<T> toDestroy) throws Exception {
+    private void destroy(final PooledSoftReference<T> toDestroy) throws Exception {
         toDestroy.invalidate();
         idleReferences.remove(toDestroy);
         allReferences.remove(toDestroy);
@@ -419,7 +419,7 @@ public class SoftReferenceObjectPool<T>
      * Clears cleared references from iterator's collection
      * @param iterator iterator over idle/allReferences
      */
-    private void removeClearedReferences(Iterator<PooledSoftReference<T>> iterator) {
+    private void removeClearedReferences(final Iterator<PooledSoftReference<T>> iterator) {
         PooledSoftReference<T> ref;
         while (iterator.hasNext()) {
             ref = iterator.next();
@@ -430,7 +430,7 @@ public class SoftReferenceObjectPool<T>
     }
 
     @Override
-    protected void toStringAppendFields(StringBuilder builder) {
+    protected void toStringAppendFields(final StringBuilder builder) {
         super.toStringAppendFields(builder);
         builder.append(", factory=");
         builder.append(factory);

Modified: tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml?rev=1743721&r1=1743720&r2=1743721&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml Fri May 13 18:50:08 2016
@@ -64,6 +64,10 @@
         Update the internal fork of Commons DBCP 2 to r1743696 (2.1.1 plus
         additional fixes). (markt)
       </update>
+      <update>
+        Update the internal fork of Commons Pool 2 to r1743697 (2.4.2 plus
+        additional fixes). (markt)
+      </update>
     </changelog>
   </subsection>
 </section>



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