commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject [2/2] commons-pool git commit: [POOL-331] Update from Java 6 to 7. Remove redundant type arguments.
Date Mon, 30 Oct 2017 23:07:56 GMT
[POOL-331] Update from Java 6 to 7. Remove redundant type arguments.

Project: http://git-wip-us.apache.org/repos/asf/commons-pool/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-pool/commit/4373a323
Tree: http://git-wip-us.apache.org/repos/asf/commons-pool/tree/4373a323
Diff: http://git-wip-us.apache.org/repos/asf/commons-pool/diff/4373a323

Branch: refs/heads/master
Commit: 4373a323eb38f6dc31dca718e331e69ed245c9d5
Parents: 7275cf1
Author: Gary Gregory <ggregory@apache.org>
Authored: Mon Oct 30 17:07:48 2017 -0600
Committer: Gary Gregory <ggregory@apache.org>
Committed: Mon Oct 30 17:07:48 2017 -0600

----------------------------------------------------------------------
 .../org/apache/commons/pool2/PoolUtils.java     | 20 ++---
 .../pool2/impl/BaseGenericObjectPool.java       |  2 +-
 .../pool2/impl/GenericKeyedObjectPool.java      | 30 +++----
 .../commons/pool2/impl/GenericObjectPool.java   | 18 ++--
 .../commons/pool2/impl/LinkedBlockingDeque.java |  4 +-
 .../pool2/impl/SecurityManagerCallStack.java    |  2 +-
 .../pool2/impl/SoftReferenceObjectPool.java     | 14 +--
 .../commons/pool2/proxy/CglibProxySource.java   |  2 +-
 .../commons/pool2/proxy/JdkProxySource.java     |  2 +-
 .../pool2/MethodCallPoolableObjectFactory.java  |  2 +-
 .../java/org/apache/commons/pool2/PoolTest.java |  4 +-
 .../TestBaseKeyedPoolableObjectFactory.java     |  2 +-
 .../pool2/TestBasePoolableObjectFactory.java    |  2 +-
 .../commons/pool2/TestKeyedObjectPool.java      | 16 ++--
 .../apache/commons/pool2/TestObjectPool.java    | 12 +--
 .../org/apache/commons/pool2/TestPoolUtils.java | 54 +++++------
 .../commons/pool2/VisitTrackerFactory.java      |  4 +-
 .../org/apache/commons/pool2/WaiterFactory.java |  4 +-
 .../pool2/impl/TestAbandonedObjectPool.java     | 12 +--
 .../pool2/impl/TestBaseGenericObjectPool.java   |  2 +-
 .../pool2/impl/TestDefaultPooledObject.java     |  4 +-
 .../pool2/impl/TestDefaultPooledObjectInfo.java |  8 +-
 .../pool2/impl/TestGenericKeyedObjectPool.java  | 94 ++++++++++----------
 .../pool2/impl/TestGenericObjectPool.java       | 82 ++++++++---------
 .../impl/TestGenericObjectPoolClassLoaders.java |  6 +-
 .../pool2/impl/TestLinkedBlockingDeque.java     | 16 ++--
 .../pool2/impl/TestPooledSoftReference.java     |  6 +-
 .../pool2/impl/TestSoftRefOutOfMemory.java      | 24 ++---
 .../pool2/impl/TestSoftReferenceObjectPool.java |  6 +-
 .../pool2/performance/PerformanceTest.java      |  4 +-
 .../performance/SleepingObjectFactory.java      |  2 +-
 .../proxy/BaseTestProxiedKeyedObjectPool.java   |  6 +-
 .../pool2/proxy/BaseTestProxiedObjectPool.java  |  6 +-
 ...estProxiedKeyedObjectPoolWithCglibProxy.java |  2 +-
 .../TestProxiedKeyedObjectPoolWithJdkProxy.java |  2 +-
 .../TestProxiedObjectPoolWithCglibProxy.java    |  2 +-
 .../TestProxiedObjectPoolWithJdkProxy.java      |  2 +-
 37 files changed, 240 insertions(+), 240 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/main/java/org/apache/commons/pool2/PoolUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/PoolUtils.java b/src/main/java/org/apache/commons/pool2/PoolUtils.java
index 6ed141d..9a863af 100644
--- a/src/main/java/org/apache/commons/pool2/PoolUtils.java
+++ b/src/main/java/org/apache/commons/pool2/PoolUtils.java
@@ -106,7 +106,7 @@ public final class PoolUtils {
         if (minIdle < 0) {
             throw new IllegalArgumentException("minIdle must be non-negative.");
         }
-        final TimerTask task = new ObjectPoolMinIdleTimerTask<T>(pool, minIdle);
+        final TimerTask task = new ObjectPoolMinIdleTimerTask<>(pool, minIdle);
         getMinIdleTimer().schedule(task, 0L, period);
         return task;
     }
@@ -150,7 +150,7 @@ public final class PoolUtils {
         if (minIdle < 0) {
             throw new IllegalArgumentException("minIdle must be non-negative.");
         }
-        final TimerTask task = new KeyedObjectPoolMinIdleTimerTask<K, V>(
+        final TimerTask task = new KeyedObjectPoolMinIdleTimerTask<>(
                 keyedPool, key, minIdle);
         getMinIdleTimer().schedule(task, 0L, period);
         return task;
@@ -190,7 +190,7 @@ public final class PoolUtils {
         if (keys == null) {
             throw new IllegalArgumentException("keys must not be null.");
         }
-        final Map<K, TimerTask> tasks = new HashMap<K, TimerTask>(keys.size());
+        final Map<K, TimerTask> tasks = new HashMap<>(keys.size());
         final Iterator<K> iter = keys.iterator();
         while (iter.hasNext()) {
             final K key = iter.next();
@@ -321,7 +321,7 @@ public final class PoolUtils {
          * .equals(pool.getClass().getName()) :
          * "CompositeObjectPools are already thread-safe";
          */
-        return new SynchronizedObjectPool<T>(pool);
+        return new SynchronizedObjectPool<>(pool);
     }
 
     /**
@@ -354,7 +354,7 @@ public final class PoolUtils {
          * .equals(keyedPool.getClass().getName()) :
          * "CompositeKeyedObjectPools are already thread-safe";
          */
-        return new SynchronizedKeyedObjectPool<K, V>(keyedPool);
+        return new SynchronizedKeyedObjectPool<>(keyedPool);
     }
 
     /**
@@ -369,7 +369,7 @@ public final class PoolUtils {
      */
     public static <T> PooledObjectFactory<T> synchronizedPooledFactory(
             final PooledObjectFactory<T> factory) {
-        return new SynchronizedPooledObjectFactory<T>(factory);
+        return new SynchronizedPooledObjectFactory<>(factory);
     }
 
     /**
@@ -385,7 +385,7 @@ public final class PoolUtils {
      */
     public static <K, V> KeyedPooledObjectFactory<K, V> synchronizedKeyedPooledFactory(
             final KeyedPooledObjectFactory<K, V> keyedFactory) {
-        return new SynchronizedKeyedPooledObjectFactory<K, V>(keyedFactory);
+        return new SynchronizedKeyedPooledObjectFactory<>(keyedFactory);
     }
 
     /**
@@ -441,7 +441,7 @@ public final class PoolUtils {
         if (factor <= 0f) {
             throw new IllegalArgumentException("factor must be positive.");
         }
-        return new ErodingObjectPool<T>(pool, factor);
+        return new ErodingObjectPool<>(pool, factor);
     }
 
     /**
@@ -544,9 +544,9 @@ public final class PoolUtils {
             throw new IllegalArgumentException("factor must be positive.");
         }
         if (perKey) {
-            return new ErodingPerKeyKeyedObjectPool<K, V>(keyedPool, factor);
+            return new ErodingPerKeyKeyedObjectPool<>(keyedPool, factor);
         }
-        return new ErodingKeyedObjectPool<K, V>(keyedPool, factor);
+        return new ErodingKeyedObjectPool<>(keyedPool, factor);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
index b901d50..5686588 100644
--- a/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
@@ -146,7 +146,7 @@ public abstract class BaseGenericObjectPool<T> extends BaseObject {
         if (cl == null) {
             factoryClassLoader = null;
         } else {
-            factoryClassLoader = new WeakReference<ClassLoader>(cl);
+            factoryClassLoader = new WeakReference<>(cl);
         }
 
         fairness = config.getFairness();

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
index 19199a7..a366ec2 100644
--- a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
@@ -463,7 +463,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
 
         final ObjectDeque<T> objectDeque = poolMap.get(key);
 
-        final PooledObject<T> p = objectDeque.getAllObjects().get(new IdentityWrapper<T>(obj));
+        final PooledObject<T> p = objectDeque.getAllObjects().get(new IdentityWrapper<>(obj));
 
         if (p == null) {
             throw new IllegalStateException(
@@ -575,7 +575,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
 
         final ObjectDeque<T> objectDeque = poolMap.get(key);
 
-        final PooledObject<T> p = objectDeque.getAllObjects().get(new IdentityWrapper<T>(obj));
+        final PooledObject<T> p = objectDeque.getAllObjects().get(new IdentityWrapper<>(obj));
         if (p == null) {
             throw new IllegalStateException(
                     "Object not currently part of this pool");
@@ -738,7 +738,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
     public void clearOldest() {
 
         // build sorted map of idle objects
-        final Map<PooledObject<T>, K> map = new TreeMap<PooledObject<T>, K>();
+        final Map<PooledObject<T>, K> map = new TreeMap<>();
 
         for (final Map.Entry<K, ObjectDeque<T>> entry : poolMap.entrySet()) {
             final K k = entry.getKey();
@@ -885,7 +885,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
                 if(evictionIterator == null || !evictionIterator.hasNext()) {
                     if (evictionKeyIterator == null ||
                             !evictionKeyIterator.hasNext()) {
-                        final List<K> keyCopy = new ArrayList<K>();
+                        final List<K> keyCopy = new ArrayList<>();
                         final Lock readLock = keyLock.readLock();
                         readLock.lock();
                         try {
@@ -1074,7 +1074,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
         }
 
         createdCount.incrementAndGet();
-        objectDeque.getAllObjects().put(new IdentityWrapper<T>(p.getObject()), p);
+        objectDeque.getAllObjects().put(new IdentityWrapper<>(p.getObject()), p);
         return p;
     }
 
@@ -1097,7 +1097,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
             final boolean isIdle = objectDeque.getIdleObjects().remove(toDestroy);
 
             if (isIdle || always) {
-                objectDeque.getAllObjects().remove(new IdentityWrapper<T>(toDestroy.getObject()));
+                objectDeque.getAllObjects().remove(new IdentityWrapper<>(toDestroy.getObject()));
                 toDestroy.invalidate();
 
                 try {
@@ -1140,7 +1140,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
                 lock.lock();
                 objectDeque = poolMap.get(k);
                 if (objectDeque == null) {
-                    objectDeque = new ObjectDeque<T>(fairness);
+                    objectDeque = new ObjectDeque<>(fairness);
                     objectDeque.getNumInterested().incrementAndGet();
                     // NOTE: Keys must always be added to both poolMap and
                     //       poolKeyList at the same time while protected by
@@ -1355,7 +1355,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
 
     @Override
     public Map<String,Integer> getNumActivePerKey() {
-        final HashMap<String,Integer> result = new HashMap<String,Integer>();
+        final HashMap<String,Integer> result = new HashMap<>();
 
         final Iterator<Entry<K,ObjectDeque<T>>> iter = poolMap.entrySet().iterator();
         while (iter.hasNext()) {
@@ -1407,7 +1407,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
      */
     @Override
     public Map<String,Integer> getNumWaitersByKey() {
-        final Map<String,Integer> result = new HashMap<String,Integer>();
+        final Map<String,Integer> result = new HashMap<>();
 
         for (final Map.Entry<K, ObjectDeque<T>> entry : poolMap.entrySet()) {
             final K k = entry.getKey();
@@ -1438,14 +1438,14 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
     @Override
     public Map<String,List<DefaultPooledObjectInfo>> listAllObjects() {
         final Map<String,List<DefaultPooledObjectInfo>> result =
-                new HashMap<String,List<DefaultPooledObjectInfo>>();
+                new HashMap<>();
 
         for (final Map.Entry<K, ObjectDeque<T>> entry : poolMap.entrySet()) {
             final K k = entry.getKey();
             final ObjectDeque<T> deque = entry.getValue();
             if (deque != null) {
                 final List<DefaultPooledObjectInfo> list =
-                        new ArrayList<DefaultPooledObjectInfo>();
+                        new ArrayList<>();
                 result.put(k.toString(), list);
                 for (final PooledObject<T> p : deque.getAllObjects().values()) {
                     list.add(new DefaultPooledObjectInfo(p));
@@ -1479,7 +1479,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
          * they work properly as keys.
          */
         private final Map<IdentityWrapper<S>, PooledObject<S>> allObjects =
-                new ConcurrentHashMap<IdentityWrapper<S>, PooledObject<S>>();
+                new ConcurrentHashMap<>();
 
         /*
          * Number of threads with registered interest in this key.
@@ -1495,7 +1495,7 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
          * will be served as if waiting in a FIFO queue.
          */
         public ObjectDeque(final boolean fairness) {
-            idleObjects = new LinkedBlockingDeque<PooledObject<S>>(fairness);
+            idleObjects = new LinkedBlockingDeque<>(fairness);
         }
 
         /**
@@ -1571,14 +1571,14 @@ implements KeyedObjectPool<K,T>, GenericKeyedObjectPoolMXBean<K> {
      * changes to the list of current keys is made in a thread-safe manner.
      */
     private final Map<K,ObjectDeque<T>> poolMap =
-            new ConcurrentHashMap<K,ObjectDeque<T>>(); // @GuardedBy("keyLock") for write access (and some read access)
+            new ConcurrentHashMap<>(); // @GuardedBy("keyLock") for write access (and some read access)
     /*
      * List of pool keys - used to control eviction order. The list of keys
      * <b>must</b> be kept in step with {@link #poolMap} using {@link #keyLock}
      * to ensure any changes to the list of current keys is made in a
      * thread-safe manner.
      */
-    private final List<K> poolKeyList = new ArrayList<K>(); // @GuardedBy("keyLock")
+    private final List<K> poolKeyList = new ArrayList<>(); // @GuardedBy("keyLock")
     private final ReadWriteLock keyLock = new ReentrantReadWriteLock(true);
     /*
      * The combined count of the currently active objects for all keys and those

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
index b901e5a..d743702 100644
--- a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
@@ -110,7 +110,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
         }
         this.factory = factory;
 
-        idleObjects = new LinkedBlockingDeque<PooledObject<T>>(config.getFairness());
+        idleObjects = new LinkedBlockingDeque<>(config.getFairness());
 
         setConfig(config);
 
@@ -522,7 +522,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
      */
     @Override
     public void returnObject(final T obj) {
-        final PooledObject<T> p = allObjects.get(new IdentityWrapper<T>(obj));
+        final PooledObject<T> p = allObjects.get(new IdentityWrapper<>(obj));
 
         if (p == null) {
             if (!isAbandonedConfig()) {
@@ -618,7 +618,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
      */
     @Override
     public void invalidateObject(final T obj) throws Exception {
-        final PooledObject<T> p = allObjects.get(new IdentityWrapper<T>(obj));
+        final PooledObject<T> p = allObjects.get(new IdentityWrapper<>(obj));
         if (p == null) {
             if (isAbandonedConfig()) {
                 return;
@@ -902,7 +902,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
         }
 
         createdCount.incrementAndGet();
-        allObjects.put(new IdentityWrapper<T>(p.getObject()), p);
+        allObjects.put(new IdentityWrapper<>(p.getObject()), p);
         return p;
     }
 
@@ -917,7 +917,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
     private void destroy(final PooledObject<T> toDestroy) throws Exception {
         toDestroy.invalidate();
         idleObjects.remove(toDestroy);
-        allObjects.remove(new IdentityWrapper<T>(toDestroy.getObject()));
+        allObjects.remove(new IdentityWrapper<>(toDestroy.getObject()));
         try {
             factory.destroyObject(toDestroy);
         } finally {
@@ -1033,7 +1033,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
         final long now = System.currentTimeMillis();
         final long timeout =
                 now - (ac.getRemoveAbandonedTimeout() * 1000L);
-        final ArrayList<PooledObject<T>> remove = new ArrayList<PooledObject<T>>();
+        final ArrayList<PooledObject<T>> remove = new ArrayList<>();
         final Iterator<PooledObject<T>> it = allObjects.values().iterator();
         while (it.hasNext()) {
             final PooledObject<T> pooledObject = it.next();
@@ -1068,7 +1068,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
     public void use(final T pooledObject) {
         final AbandonedConfig ac = this.abandonedConfig;
         if (ac != null && ac.getUseUsageTracking()) {
-            final PooledObject<T> wrapper = allObjects.get(new IdentityWrapper<T>(pooledObject));
+            final PooledObject<T> wrapper = allObjects.get(new IdentityWrapper<>(pooledObject));
             wrapper.use();
         }
     }
@@ -1130,7 +1130,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
     @Override
     public Set<DefaultPooledObjectInfo> listAllObjects() {
         final Set<DefaultPooledObjectInfo> result =
-                new HashSet<DefaultPooledObjectInfo>(allObjects.size());
+                new HashSet<>(allObjects.size());
         for (final PooledObject<T> p : allObjects.values()) {
             result.add(new DefaultPooledObjectInfo(p));
         }
@@ -1154,7 +1154,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
      * wrappers used internally by the pool.
      */
     private final Map<IdentityWrapper<T>, PooledObject<T>> allObjects =
-        new ConcurrentHashMap<IdentityWrapper<T>, PooledObject<T>>();
+        new ConcurrentHashMap<>();
     /*
      * The combined count of the currently created objects and those in the
      * process of being created. Under load, it may exceed {@link #_maxActive}

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/main/java/org/apache/commons/pool2/impl/LinkedBlockingDeque.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/LinkedBlockingDeque.java b/src/main/java/org/apache/commons/pool2/impl/LinkedBlockingDeque.java
index 6cf9f4e..aa57b84 100644
--- a/src/main/java/org/apache/commons/pool2/impl/LinkedBlockingDeque.java
+++ b/src/main/java/org/apache/commons/pool2/impl/LinkedBlockingDeque.java
@@ -245,7 +245,7 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
             return false;
         }
         final Node<E> f = first;
-        final Node<E> x = new Node<E>(e, null, f);
+        final Node<E> x = new Node<>(e, null, f);
         first = x;
         if (last == null) {
             last = x;
@@ -270,7 +270,7 @@ class LinkedBlockingDeque<E> extends AbstractQueue<E>
             return false;
         }
         final Node<E> l = last;
-        final Node<E> x = new Node<E>(e, l, null);
+        final Node<E> x = new Node<>(e, l, null);
         last = x;
         if (first == null) {
             first = x;

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/main/java/org/apache/commons/pool2/impl/SecurityManagerCallStack.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/SecurityManagerCallStack.java b/src/main/java/org/apache/commons/pool2/impl/SecurityManagerCallStack.java
index e217a8f..39d54bc 100644
--- a/src/main/java/org/apache/commons/pool2/impl/SecurityManagerCallStack.java
+++ b/src/main/java/org/apache/commons/pool2/impl/SecurityManagerCallStack.java
@@ -88,7 +88,7 @@ public class SecurityManagerCallStack implements CallStack {
     private static class PrivateSecurityManager extends SecurityManager {
         private List<WeakReference<Class<?>>> getCallStack() {
             final Class<?>[] classes = getClassContext();
-            final List<WeakReference<Class<?>>> stack = new ArrayList<WeakReference<Class<?>>>(classes.length);
+            final List<WeakReference<Class<?>>> stack = new ArrayList<>(classes.length);
             for (final Class<?> klass : classes) {
                 stack.add(new WeakReference<Class<?>>(klass));
             }

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/main/java/org/apache/commons/pool2/impl/SoftReferenceObjectPool.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/SoftReferenceObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/SoftReferenceObjectPool.java
index 8bcf1fb..0f6bcc5 100644
--- a/src/main/java/org/apache/commons/pool2/impl/SoftReferenceObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/SoftReferenceObjectPool.java
@@ -48,7 +48,7 @@ public class SoftReferenceObjectPool<T> extends BaseObjectPool<T> {
      * <code>_pool</code>. This is used to help {@link #getNumIdle()} be more
      * accurate with minimal performance overhead.
      */
-    private final ReferenceQueue<T> refQueue = new ReferenceQueue<T>();
+    private final ReferenceQueue<T> refQueue = new ReferenceQueue<>();
 
     /** Count of instances that have been checkout out to pool clients */
     private int numActive = 0; // @GuardedBy("this")
@@ -62,11 +62,11 @@ public class SoftReferenceObjectPool<T> extends BaseObjectPool<T> {
 
     /** Idle references - waiting to be borrowed */
     private final LinkedBlockingDeque<PooledSoftReference<T>> idleReferences =
-        new LinkedBlockingDeque<PooledSoftReference<T>>();
+        new LinkedBlockingDeque<>();
 
     /** All references - checked out or waiting to be borrowed. */
     private final ArrayList<PooledSoftReference<T>> allReferences =
-        new ArrayList<PooledSoftReference<T>>();
+        new ArrayList<>();
 
     /**
      * Create a <code>SoftReferenceObjectPool</code> with the specified factory.
@@ -127,7 +127,7 @@ public class SoftReferenceObjectPool<T> extends BaseObjectPool<T> {
                 obj = factory.makeObject().getObject();
                 createCount++;
                 // Do not register with the queue
-                ref = new PooledSoftReference<T>(new SoftReference<T>(obj));
+                ref = new PooledSoftReference<>(new SoftReference<>(obj));
                 allReferences.add(ref);
             } else {
                 ref = idleReferences.pollFirst();
@@ -136,7 +136,7 @@ public class SoftReferenceObjectPool<T> extends BaseObjectPool<T> {
                 // a new, non-registered reference so we can still track this object
                 // in allReferences
                 ref.getReference().clear();
-                ref.setReference(new SoftReference<T>(obj));
+                ref.setReference(new SoftReference<>(obj));
             }
             if (null != factory && null != obj) {
                 try {
@@ -274,8 +274,8 @@ public class SoftReferenceObjectPool<T> extends BaseObjectPool<T> {
         final T obj = factory.makeObject().getObject();
         createCount++;
         // Create and register with the queue
-        final PooledSoftReference<T> ref = new PooledSoftReference<T>(
-                new SoftReference<T>(obj, refQueue));
+        final PooledSoftReference<T> ref = new PooledSoftReference<>(
+                new SoftReference<>(obj, refQueue));
         allReferences.add(ref);
 
         boolean success = true;

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java b/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java
index 9784b5f..e849ba4 100644
--- a/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java
+++ b/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java
@@ -47,7 +47,7 @@ public class CglibProxySource<T> implements ProxySource<T> {
         enhancer.setSuperclass(superclass);
 
         final CglibProxyHandler<T> proxyInterceptor =
-                new CglibProxyHandler<T>(pooledObject, usageTracking);
+                new CglibProxyHandler<>(pooledObject, usageTracking);
         enhancer.setCallback(proxyInterceptor);
 
         @SuppressWarnings("unchecked")

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/main/java/org/apache/commons/pool2/proxy/JdkProxySource.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/proxy/JdkProxySource.java b/src/main/java/org/apache/commons/pool2/proxy/JdkProxySource.java
index 80aa07d..fa9fa19 100644
--- a/src/main/java/org/apache/commons/pool2/proxy/JdkProxySource.java
+++ b/src/main/java/org/apache/commons/pool2/proxy/JdkProxySource.java
@@ -53,7 +53,7 @@ public class JdkProxySource<T> implements ProxySource<T> {
         @SuppressWarnings("unchecked")
         final
         T proxy = (T) Proxy.newProxyInstance(classLoader, interfaces,
-                new JdkProxyHandler<T>(pooledObject, usageTracking));
+                new JdkProxyHandler<>(pooledObject, usageTracking));
         return proxy;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/MethodCallPoolableObjectFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/MethodCallPoolableObjectFactory.java b/src/test/java/org/apache/commons/pool2/MethodCallPoolableObjectFactory.java
index 712bb6e..edbdee0 100644
--- a/src/test/java/org/apache/commons/pool2/MethodCallPoolableObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool2/MethodCallPoolableObjectFactory.java
@@ -29,7 +29,7 @@ import org.apache.commons.pool2.impl.DefaultPooledObject;
  * @see MethodCall
  */
 public class MethodCallPoolableObjectFactory implements PooledObjectFactory<Object> {
-    private final List<MethodCall> methodCalls = new ArrayList<MethodCall>();
+    private final List<MethodCall> methodCalls = new ArrayList<>();
     private int count = 0;
     private boolean valid = true;
     private boolean makeObjectFail;

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/PoolTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/PoolTest.java b/src/test/java/org/apache/commons/pool2/PoolTest.java
index 0a96feb..837a7d9 100644
--- a/src/test/java/org/apache/commons/pool2/PoolTest.java
+++ b/src/test/java/org/apache/commons/pool2/PoolTest.java
@@ -38,7 +38,7 @@ public class PoolTest {
 
         @Override
         public PooledObject<Foo> makeObject() throws Exception {
-            return new DefaultPooledObject<Foo>(new Foo());
+            return new DefaultPooledObject<>(new Foo());
         }
 
         @Override
@@ -71,7 +71,7 @@ public class PoolTest {
         final PooledFooFactory pooledFooFactory = new PooledFooFactory();
         GenericObjectPool<Foo> pool = null;
         try {
-            pool = new GenericObjectPool<Foo>(pooledFooFactory, poolConfig);
+            pool = new GenericObjectPool<>(pooledFooFactory, poolConfig);
             pool.setTimeBetweenEvictionRunsMillis(EVICTION_PERIOD_IN_MILLIS);
             pool.addObject();
             try {

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/TestBaseKeyedPoolableObjectFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/TestBaseKeyedPoolableObjectFactory.java b/src/test/java/org/apache/commons/pool2/TestBaseKeyedPoolableObjectFactory.java
index 334fcce..58af0bd 100644
--- a/src/test/java/org/apache/commons/pool2/TestBaseKeyedPoolableObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool2/TestBaseKeyedPoolableObjectFactory.java
@@ -43,7 +43,7 @@ public class TestBaseKeyedPoolableObjectFactory {
         }
         @Override
         public PooledObject<Object> wrap(final Object value) {
-            return new DefaultPooledObject<Object>(value);
+            return new DefaultPooledObject<>(value);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/TestBasePoolableObjectFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/TestBasePoolableObjectFactory.java b/src/test/java/org/apache/commons/pool2/TestBasePoolableObjectFactory.java
index 201dfcc..11fa724 100644
--- a/src/test/java/org/apache/commons/pool2/TestBasePoolableObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool2/TestBasePoolableObjectFactory.java
@@ -42,7 +42,7 @@ public class TestBasePoolableObjectFactory {
         }
         @Override
         public PooledObject<Object> wrap(final Object value) {
-            return new DefaultPooledObject<Object>(value);
+            return new DefaultPooledObject<>(value);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/TestKeyedObjectPool.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/TestKeyedObjectPool.java b/src/test/java/org/apache/commons/pool2/TestKeyedObjectPool.java
index eb175bf..c972d67 100644
--- a/src/test/java/org/apache/commons/pool2/TestKeyedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool2/TestKeyedObjectPool.java
@@ -139,7 +139,7 @@ public abstract class TestKeyedObjectPool {
         } catch(final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
 
         // addObject should make a new object, passivate it and put it in the pool
         pool.addObject(KEY);
@@ -187,7 +187,7 @@ public abstract class TestKeyedObjectPool {
         } catch(final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
         Object obj;
 
         if (pool instanceof GenericKeyedObjectPool) {
@@ -275,7 +275,7 @@ public abstract class TestKeyedObjectPool {
         } catch(final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
         Object obj;
 
         /// Test correct behavior code paths
@@ -333,7 +333,7 @@ public abstract class TestKeyedObjectPool {
         } catch(final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
         Object obj;
 
         /// Test correct behavior code paths
@@ -372,7 +372,7 @@ public abstract class TestKeyedObjectPool {
         } catch(final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
 
         /// Test correct behavior code paths
         PoolUtils.prefill(pool, KEY, 5);
@@ -395,7 +395,7 @@ public abstract class TestKeyedObjectPool {
         } catch(final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
 
         /// Test correct behavior code paths
         PoolUtils.prefill(pool, KEY, 5);
@@ -674,12 +674,12 @@ public abstract class TestKeyedObjectPool {
         }
         @Override
         public PooledObject<Object> wrap(final Object value) {
-            return new DefaultPooledObject<Object>(value);
+            return new DefaultPooledObject<>(value);
         }
     }
 
     protected static class FailingKeyedPooledObjectFactory implements KeyedPooledObjectFactory<Object,Object> {
-        private final List<MethodCall> methodCalls = new ArrayList<MethodCall>();
+        private final List<MethodCall> methodCalls = new ArrayList<>();
         private int count = 0;
         private boolean makeObjectFail;
         private boolean activateObjectFail;

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/TestObjectPool.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/TestObjectPool.java b/src/test/java/org/apache/commons/pool2/TestObjectPool.java
index 2dc7316..38741d4 100644
--- a/src/test/java/org/apache/commons/pool2/TestObjectPool.java
+++ b/src/test/java/org/apache/commons/pool2/TestObjectPool.java
@@ -116,7 +116,7 @@ public abstract class TestObjectPool {
         } catch(final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
 
         assertEquals(0, pool.getNumActive());
         assertEquals(0, pool.getNumIdle());
@@ -181,7 +181,7 @@ public abstract class TestObjectPool {
         if (pool instanceof GenericObjectPool) {
             ((GenericObjectPool<Object>) pool).setTestOnBorrow(true);
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
         Object obj;
 
         /// Test correct behavior code paths
@@ -262,7 +262,7 @@ public abstract class TestObjectPool {
         } catch (final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
         Object obj;
 
         /// Test correct behavior code paths
@@ -323,7 +323,7 @@ public abstract class TestObjectPool {
         } catch (final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
         Object obj;
 
         /// Test correct behavior code paths
@@ -362,7 +362,7 @@ public abstract class TestObjectPool {
         } catch (final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
 
         /// Test correct behavior code paths
         PoolUtils.prefill(pool, 5);
@@ -385,7 +385,7 @@ public abstract class TestObjectPool {
         } catch (final UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
+        final List<MethodCall> expectedMethods = new ArrayList<>();
 
         /// Test correct behavior code paths
         PoolUtils.prefill(pool, 5);

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/TestPoolUtils.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/TestPoolUtils.java b/src/test/java/org/apache/commons/pool2/TestPoolUtils.java
index a8d63a5..0c9f0ed 100644
--- a/src/test/java/org/apache/commons/pool2/TestPoolUtils.java
+++ b/src/test/java/org/apache/commons/pool2/TestPoolUtils.java
@@ -105,12 +105,12 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
 
         // Test that the minIdle check doesn't add too many idle objects
         @SuppressWarnings("unchecked")
         final PooledObjectFactory<Object> pof = createProxy(PooledObjectFactory.class, calledMethods);
-        final ObjectPool<Object> op = new GenericObjectPool<Object>(pof);
+        final ObjectPool<Object> op = new GenericObjectPool<>(pof);
         PoolUtils.checkMinIdle(op, 2, 100);
         Thread.sleep(1000);
         assertEquals(2, op.getNumIdle());
@@ -140,7 +140,7 @@ public class TestPoolUtils {
                 task.cancel();
                 task.toString();
 
-                final List<String> expectedMethods = new ArrayList<String>();
+                final List<String> expectedMethods = new ArrayList<>();
                 for (int i=0; i < CHECK_COUNT; i++) {
                     expectedMethods.add("getNumIdle");
                     expectedMethods.add("addObject");
@@ -181,7 +181,7 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         final Object key = new Object();
 
         // Test that the minIdle check doesn't add too many idle objects
@@ -189,7 +189,7 @@ public class TestPoolUtils {
         final KeyedPooledObjectFactory<Object,Object> kpof =
             createProxy(KeyedPooledObjectFactory.class, calledMethods);
         final KeyedObjectPool<Object,Object> kop =
-                new GenericKeyedObjectPool<Object,Object>(kpof);
+                new GenericKeyedObjectPool<>(kpof);
         PoolUtils.checkMinIdle(kop, key, 2, 100);
         Thread.sleep(400);
         assertEquals(2, kop.getNumIdle(key));
@@ -220,7 +220,7 @@ public class TestPoolUtils {
                 task.cancel();
                 task.toString();
 
-                final List<String> expectedMethods = new ArrayList<String>();
+                final List<String> expectedMethods = new ArrayList<>();
                 for (int i=0; i < CHECK_COUNT; i++) {
                     expectedMethods.add("getNumIdle");
                     expectedMethods.add("addObject");
@@ -261,10 +261,10 @@ public class TestPoolUtils {
         do {
             afe = null;
             try {
-                final List<String> calledMethods = new ArrayList<String>();
+                final List<String> calledMethods = new ArrayList<>();
                 @SuppressWarnings("unchecked")
                 final KeyedObjectPool<String,Object> pool = createProxy(KeyedObjectPool.class, calledMethods);
-                final Collection<String> keys = new ArrayList<String>(2);
+                final Collection<String> keys = new ArrayList<>(2);
                 keys.add("one");
                 keys.add("two");
                 final Map<String, TimerTask> tasks = PoolUtils.checkMinIdle(pool, keys, 1, CHECK_PERIOD); // checks minIdle immediately
@@ -274,7 +274,7 @@ public class TestPoolUtils {
                     task.cancel();
                 }
 
-                final List<String> expectedMethods = new ArrayList<String>();
+                final List<String> expectedMethods = new ArrayList<>();
                 for (int i=0; i < CHECK_COUNT * keys.size(); i++) {
                     expectedMethods.add("getNumIdle");
                     expectedMethods.add("addObject");
@@ -298,12 +298,12 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         @SuppressWarnings("unchecked")
         final ObjectPool<Object> pool = createProxy(ObjectPool.class, calledMethods);
 
         PoolUtils.prefill(pool, 0);
-        final List<String> expectedMethods = new ArrayList<String>();
+        final List<String> expectedMethods = new ArrayList<>();
         assertEquals(expectedMethods, calledMethods);
 
         calledMethods.clear();
@@ -331,12 +331,12 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         @SuppressWarnings("unchecked")
         final KeyedObjectPool<Object,Object> pool = createProxy(KeyedObjectPool.class, calledMethods);
 
         PoolUtils.prefill(pool, new Object(), 0);
-        final List<String> expectedMethods = new ArrayList<String>();
+        final List<String> expectedMethods = new ArrayList<>();
         assertEquals(expectedMethods, calledMethods);
 
         calledMethods.clear();
@@ -358,13 +358,13 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         @SuppressWarnings("unchecked")
         final KeyedObjectPool<String,Object> pool = createProxy(KeyedObjectPool.class, calledMethods);
 
-        final Set<String> keys = new HashSet<String>();
+        final Set<String> keys = new HashSet<>();
         PoolUtils.prefill(pool, keys, 0);
-        final List<String> expectedMethods = new ArrayList<String>();
+        final List<String> expectedMethods = new ArrayList<>();
         assertEquals(expectedMethods, calledMethods);
 
         calledMethods.clear();
@@ -387,7 +387,7 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         @SuppressWarnings("unchecked")
         final ObjectPool<Object> op = createProxy(ObjectPool.class, calledMethods);
 
@@ -407,7 +407,7 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         @SuppressWarnings("unchecked")
         final KeyedObjectPool<Object,Object> kop = createProxy(KeyedObjectPool.class, calledMethods);
 
@@ -427,7 +427,7 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         @SuppressWarnings("unchecked")
         final PooledObjectFactory<Object> pof =
                 createProxy(PooledObjectFactory.class, calledMethods);
@@ -448,7 +448,7 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         @SuppressWarnings("unchecked")
         final KeyedPooledObjectFactory<Object,Object> kpof =
                 createProxy(KeyedPooledObjectFactory.class, calledMethods);
@@ -476,7 +476,7 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         final InvocationHandler handler = new MethodCallLogger(calledMethods) {
             @Override
             public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
@@ -504,7 +504,7 @@ public class TestPoolUtils {
         final ObjectPool<Object> pool = PoolUtils.erodingPool(
                 createProxy(ObjectPool.class, handler), factor);
 
-        final List<String> expectedMethods = new ArrayList<String>();
+        final List<String> expectedMethods = new ArrayList<>();
         assertEquals(expectedMethods, calledMethods);
 
         pool.addObject();
@@ -596,7 +596,7 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         final InvocationHandler handler = new MethodCallLogger(calledMethods) {
             @Override
             public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
@@ -633,7 +633,7 @@ public class TestPoolUtils {
         final KeyedObjectPool<Object,Object> pool =
             PoolUtils.erodingPool(createProxy(KeyedObjectPool.class, handler), factor);
 
-        final List<String> expectedMethods = new ArrayList<String>();
+        final List<String> expectedMethods = new ArrayList<>();
         assertEquals(expectedMethods, calledMethods);
 
         final Object key = "key";
@@ -727,7 +727,7 @@ public class TestPoolUtils {
             // expected
         }
 
-        final List<String> calledMethods = new ArrayList<String>();
+        final List<String> calledMethods = new ArrayList<>();
         final InvocationHandler handler = new MethodCallLogger(calledMethods) {
             @Override
             public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
@@ -746,7 +746,7 @@ public class TestPoolUtils {
         final KeyedObjectPool<Object,Object> pool = PoolUtils.erodingPool(
                 createProxy(KeyedObjectPool.class, handler), factor, true);
 
-        final List<String> expectedMethods = new ArrayList<String>();
+        final List<String> expectedMethods = new ArrayList<>();
         assertEquals(expectedMethods, calledMethods);
 
         final Object key = "key";
@@ -901,7 +901,7 @@ public class TestPoolUtils {
             } else if (Object.class.equals(method.getReturnType())) {
                 return new Object();
             } else if (PooledObject.class.equals(method.getReturnType())) {
-                return new DefaultPooledObject<Object>(new Object());
+                return new DefaultPooledObject<>(new Object());
             } else {
                 return null;
             }

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/VisitTrackerFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/VisitTrackerFactory.java b/src/test/java/org/apache/commons/pool2/VisitTrackerFactory.java
index 155613c..8346655 100644
--- a/src/test/java/org/apache/commons/pool2/VisitTrackerFactory.java
+++ b/src/test/java/org/apache/commons/pool2/VisitTrackerFactory.java
@@ -35,12 +35,12 @@ public class VisitTrackerFactory<K>
 
     @Override
     public PooledObject<VisitTracker<K>> makeObject() {
-        return new DefaultPooledObject<VisitTracker<K>>(new VisitTracker<K>(nextId++));
+        return new DefaultPooledObject<>(new VisitTracker<K>(nextId++));
     }
 
     @Override
     public PooledObject<VisitTracker<K>> makeObject(final K key) {
-        return new DefaultPooledObject<VisitTracker<K>>(new VisitTracker<K>(nextId++, key));
+        return new DefaultPooledObject<>(new VisitTracker<>(nextId++, key));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/WaiterFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/WaiterFactory.java b/src/test/java/org/apache/commons/pool2/WaiterFactory.java
index 3ac1709..1ab30f2 100644
--- a/src/test/java/org/apache/commons/pool2/WaiterFactory.java
+++ b/src/test/java/org/apache/commons/pool2/WaiterFactory.java
@@ -59,7 +59,7 @@ KeyedPooledObjectFactory<K,Waiter> {
     private long activeCount = 0;
 
     /** Count of (makes - destroys) per key since last reset */
-    private final Map<K,Integer> activeCounts = new HashMap<K,Integer>();
+    private final Map<K,Integer> activeCounts = new HashMap<>();
 
     /** Maximum of (makes - destroys) - if exceeded IllegalStateException */
     private final long maxActive;  // GKOP 1.x calls this maxTotal
@@ -124,7 +124,7 @@ KeyedPooledObjectFactory<K,Waiter> {
             activeCount++;
         }
         doWait(makeLatency);
-        return new DefaultPooledObject<Waiter>(new Waiter(false, true, waiterLatency));
+        return new DefaultPooledObject<>(new Waiter(false, true, waiterLatency));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/impl/TestAbandonedObjectPool.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/impl/TestAbandonedObjectPool.java b/src/test/java/org/apache/commons/pool2/impl/TestAbandonedObjectPool.java
index 1789026..6dadbce 100644
--- a/src/test/java/org/apache/commons/pool2/impl/TestAbandonedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool2/impl/TestAbandonedObjectPool.java
@@ -52,7 +52,7 @@ public class TestAbandonedObjectPool {
 
         abandonedConfig.setRemoveAbandonedOnBorrow(true);
         abandonedConfig.setRemoveAbandonedTimeout(1);
-        pool = new GenericObjectPool<PooledTestObject>(
+        pool = new GenericObjectPool<>(
                new SimpleFactory(),
                new GenericObjectPoolConfig(),
                abandonedConfig);
@@ -98,7 +98,7 @@ public class TestAbandonedObjectPool {
         pool.setBlockWhenExhausted(false);
 
         // Exhaust the connection pool
-        final ArrayList<PooledTestObject> vec = new ArrayList<PooledTestObject>();
+        final ArrayList<PooledTestObject> vec = new ArrayList<>();
         for (int i = 0; i < POOL_SIZE; i++) {
             vec.add(pool.borrowObject());
         }
@@ -146,7 +146,7 @@ public class TestAbandonedObjectPool {
         abandonedConfig.setRemoveAbandonedOnBorrow(true);
         abandonedConfig.setRemoveAbandonedTimeout(1);
         pool.close();  // Unregister pool created by setup
-        pool = new GenericObjectPool<PooledTestObject>(
+        pool = new GenericObjectPool<>(
                 new SimpleFactory(200, 0),
                 new GenericObjectPoolConfig(), abandonedConfig);
         final int n = 10;
@@ -183,7 +183,7 @@ public class TestAbandonedObjectPool {
         abandonedConfig.setRemoveAbandonedOnMaintenance(true);
         abandonedConfig.setRemoveAbandonedTimeout(1);
         pool.close();  // Unregister pool created by setup
-        pool = new GenericObjectPool<PooledTestObject>(
+        pool = new GenericObjectPool<>(
                 // destroys take 200 ms
                 new SimpleFactory(200, 0),
                 new GenericObjectPoolConfig(), abandonedConfig);
@@ -214,7 +214,7 @@ public class TestAbandonedObjectPool {
         abandonedConfig.setRemoveAbandonedOnMaintenance(true);
         abandonedConfig.setRemoveAbandonedTimeout(1);
         pool.close();  // Unregister pool created by setup
-        pool = new GenericObjectPool<PooledTestObject>(
+        pool = new GenericObjectPool<>(
              // validate takes 1 second
                 new SimpleFactory(0, 1000),
                 new GenericObjectPoolConfig(), abandonedConfig);
@@ -333,7 +333,7 @@ public class TestAbandonedObjectPool {
 
         @Override
         public PooledObject<PooledTestObject> makeObject() {
-            return new DefaultPooledObject<PooledTestObject>(new PooledTestObject());
+            return new DefaultPooledObject<>(new PooledTestObject());
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/impl/TestBaseGenericObjectPool.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/impl/TestBaseGenericObjectPool.java b/src/test/java/org/apache/commons/pool2/impl/TestBaseGenericObjectPool.java
index 2e194a0..3b90a4f 100644
--- a/src/test/java/org/apache/commons/pool2/impl/TestBaseGenericObjectPool.java
+++ b/src/test/java/org/apache/commons/pool2/impl/TestBaseGenericObjectPool.java
@@ -33,7 +33,7 @@ public class TestBaseGenericObjectPool {
     @Before
     public void setUp() throws Exception {
         factory = new SimpleFactory();
-        pool = new GenericObjectPool<String>(factory);
+        pool = new GenericObjectPool<>(factory);
     }
 
     @After

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObject.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObject.java b/src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObject.java
index 6484afd..cba537a 100644
--- a/src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObject.java
+++ b/src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObject.java
@@ -34,7 +34,7 @@ public class TestDefaultPooledObject {
      */
     @Test
     public void testgetIdleTimeMillis() throws Exception {
-        final DefaultPooledObject<Object> dpo = new DefaultPooledObject<Object>(new Object());
+        final DefaultPooledObject<Object> dpo = new DefaultPooledObject<>(new Object());
         final AtomicBoolean negativeIdleTimeReturned = new AtomicBoolean(false);
         final ExecutorService executor = Executors.newFixedThreadPool(
                                       Runtime.getRuntime().availableProcessors()*3);
@@ -69,7 +69,7 @@ public class TestDefaultPooledObject {
             }
         };
         final double probabilityOfAllocationTask = 0.7;
-        final List<Future<?>> futures = new ArrayList<Future<?>>();
+        final List<Future<?>> futures = new ArrayList<>();
         for (int i = 1; i <= 10000; i++) {
             final Runnable randomTask = Math.random() < probabilityOfAllocationTask ?
                                   allocateAndDeallocateTask : getIdleTimeTask;

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObjectInfo.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObjectInfo.java b/src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObjectInfo.java
index 42f2b17..88728f9 100644
--- a/src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObjectInfo.java
+++ b/src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObjectInfo.java
@@ -28,7 +28,7 @@ public class TestDefaultPooledObjectInfo {
     @Test
     public void testTiming() throws Exception {
         final GenericObjectPool<String> pool =
-                new GenericObjectPool<String>(new SimpleFactory());
+                new GenericObjectPool<>(new SimpleFactory());
 
         final long t1 = System.currentTimeMillis();
 
@@ -77,7 +77,7 @@ public class TestDefaultPooledObjectInfo {
     @Test
     public void testGetPooledObjectType() throws Exception {
         final GenericObjectPool<String> pool =
-                new GenericObjectPool<String>(new SimpleFactory());
+                new GenericObjectPool<>(new SimpleFactory());
 
         pool.borrowObject();
 
@@ -94,7 +94,7 @@ public class TestDefaultPooledObjectInfo {
     @Test
     public void testGetPooledObjectToString() throws Exception {
         final GenericObjectPool<String> pool =
-                new GenericObjectPool<String>(new SimpleFactory());
+                new GenericObjectPool<>(new SimpleFactory());
 
         final String s1 = pool.borrowObject();
 
@@ -114,7 +114,7 @@ public class TestDefaultPooledObjectInfo {
         abandonedConfig.setRemoveAbandonedOnBorrow(true);
         abandonedConfig.setRemoveAbandonedTimeout(1);
         abandonedConfig.setLogAbandoned(true);
-        final GenericObjectPool<String> pool = new GenericObjectPool<String>(
+        final GenericObjectPool<String> pool = new GenericObjectPool<>(
                 new SimpleFactory(),
                 new GenericObjectPoolConfig(),
                 abandonedConfig);

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/4373a323/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java b/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
index ffee23d..4aef60b 100644
--- a/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
@@ -71,7 +71,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         final KeyedPooledObjectFactory<Object,Object> perKeyFactory =
                 new SimplePerKeyFactory();
         final GenericKeyedObjectPool<Object,Object> perKeyPool =
-            new GenericKeyedObjectPool<Object,Object>(perKeyFactory);
+            new GenericKeyedObjectPool<>(perKeyFactory);
         perKeyPool.setMaxTotalPerKey(mincapacity);
         perKeyPool.setMaxIdlePerKey(mincapacity);
         return perKeyPool;
@@ -79,7 +79,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
 
     @Override
     protected KeyedObjectPool<Object,Object> makeEmptyPool(final KeyedPooledObjectFactory<Object,Object> fac) {
-        return new GenericKeyedObjectPool<Object,Object>(fac);
+        return new GenericKeyedObjectPool<>(fac);
     }
 
     @Override
@@ -102,8 +102,8 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
 
     @Before
     public void setUp() throws Exception {
-        factory = new SimpleFactory<String>();
-        pool = new GenericKeyedObjectPool<String,String>(factory);
+        factory = new SimpleFactory<>();
+        pool = new GenericKeyedObjectPool<>(factory);
     }
 
     @Override
@@ -426,7 +426,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         config.setTimeBetweenEvictionRunsMillis(500);
         config.setMinEvictableIdleTimeMillis(50);
         config.setNumTestsPerEvictionRun(5);
-        final GenericKeyedObjectPool<String, String> p = new GenericKeyedObjectPool<String, String>(factory, config);
+        final GenericKeyedObjectPool<String, String> p = new GenericKeyedObjectPool<>(factory, config);
         for(int i=0;i<5;i++) {
             p.addObject("one");
         }
@@ -543,9 +543,9 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
      * @param gkopPool      The keyed object pool to use
      */
     public <T> void runTestThreads(final int numThreads, final int iterations, final int delay, final GenericKeyedObjectPool<String,T> gkopPool) {
-        final ArrayList<TestThread<T>> threads = new ArrayList<TestThread<T>>();
+        final ArrayList<TestThread<T>> threads = new ArrayList<>();
         for(int i=0;i<numThreads;i++) {
-            final TestThread<T> testThread = new TestThread<T>(gkopPool, iterations, delay);
+            final TestThread<T> testThread = new TestThread<>(gkopPool, iterations, delay);
             threads.add(testThread);
             final Thread t = new Thread(testThread);
             t.start();
@@ -760,9 +760,9 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
     }
 
     private void checkEvictionOrder(final boolean lifo) throws Exception {
-        final SimpleFactory<Integer> intFactory = new SimpleFactory<Integer>();
+        final SimpleFactory<Integer> intFactory = new SimpleFactory<>();
         final GenericKeyedObjectPool<Integer,String> intPool =
-            new GenericKeyedObjectPool<Integer,String>(intFactory);
+            new GenericKeyedObjectPool<>(intFactory);
         intPool.setNumTestsPerEvictionRun(2);
         intPool.setMinEvictableIdleTimeMillis(100);
         intPool.setLifo(lifo);
@@ -886,9 +886,9 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
     }
 
     private void checkEvictorVisiting(final boolean lifo) throws Exception {
-        VisitTrackerFactory<Integer> trackerFactory = new VisitTrackerFactory<Integer>();
+        VisitTrackerFactory<Integer> trackerFactory = new VisitTrackerFactory<>();
         GenericKeyedObjectPool<Integer,VisitTracker<Integer>> intPool =
-            new GenericKeyedObjectPool<Integer,VisitTracker<Integer>>(trackerFactory);
+            new GenericKeyedObjectPool<>(trackerFactory);
         intPool.setNumTestsPerEvictionRun(2);
         intPool.setMinEvictableIdleTimeMillis(-1);
         intPool.setTestWhileIdle(true);
@@ -975,8 +975,8 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
             for (int j = 0; j < 5; j++) {// Try the tests a few times
                 // Can't use clear as some objects are still active so create
                 // a new pool
-                trackerFactory = new VisitTrackerFactory<Integer>();
-                intPool = new GenericKeyedObjectPool<Integer,VisitTracker<Integer>>(trackerFactory);
+                trackerFactory = new VisitTrackerFactory<>();
+                intPool = new GenericKeyedObjectPool<>(trackerFactory);
                 intPool.setMaxIdlePerKey(-1);
                 intPool.setMaxTotalPerKey(-1);
                 intPool.setNumTestsPerEvictionRun(smallPrimes[i]);
@@ -1074,7 +1074,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         config.setLifo(false);
         config.setMaxIdlePerKey(maxTotal);
 
-        pool = new GenericKeyedObjectPool<String, String>(factory, config);
+        pool = new GenericKeyedObjectPool<>(factory, config);
 
         // Exhaust the pool
         final String[] objects = new String[maxTotal];
@@ -1136,7 +1136,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         final KeyedPooledObjectFactory<Object,Object> dummyFactory = new DummyFactory();
 
         GenericKeyedObjectPool<Object,Object> objPool =
-                new GenericKeyedObjectPool<Object,Object>(dummyFactory);
+                new GenericKeyedObjectPool<>(dummyFactory);
         assertEquals(GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL_PER_KEY, objPool.getMaxTotalPerKey());
         assertEquals(GenericKeyedObjectPoolConfig.DEFAULT_MAX_IDLE_PER_KEY, objPool.getMaxIdlePerKey());
         assertEquals(BaseObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS, objPool.getMaxWaitMillis());
@@ -1175,7 +1175,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         config.setTestWhileIdle(testWhileIdle);
         config.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
         config.setBlockWhenExhausted(blockWhenExhausted);
-        objPool = new GenericKeyedObjectPool<Object,Object>(dummyFactory, config);
+        objPool = new GenericKeyedObjectPool<>(dummyFactory, config);
         assertEquals(maxTotalPerKey, objPool.getMaxTotalPerKey());
         assertEquals(maxIdle, objPool.getMaxIdlePerKey());
         assertEquals(maxWait, objPool.getMaxWaitMillis());
@@ -1291,7 +1291,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         pool.borrowObject("one");
         final long start = System.currentTimeMillis();
         // Needs to be in a separate thread as this will block
-        final Runnable simple = new SimpleTestThread<String>(pool, "one");
+        final Runnable simple = new SimpleTestThread<>(pool, "one");
         (new Thread(simple)).start();
         // This should be almost instant. If it isn't it means this thread got
         // stuck behind the thread created above which is bad.
@@ -1377,11 +1377,11 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
      */
     @Test(timeout=200000)
     public void testMaxActivePerKeyExceeded() throws Exception {
-        final WaiterFactory<String> waiterFactory = new WaiterFactory<String>(0, 20, 0, 0, 0, 0, 8, 5, 0);
+        final WaiterFactory<String> waiterFactory = new WaiterFactory<>(0, 20, 0, 0, 0, 0, 8, 5, 0);
         // TODO Fix this. Can't use local pool since runTestThreads uses the
         //      protected pool field
         final GenericKeyedObjectPool<String,Waiter> waiterPool =
-                new GenericKeyedObjectPool<String,Waiter>(waiterFactory);
+                new GenericKeyedObjectPool<>(waiterFactory);
         waiterPool.setMaxTotalPerKey(5);
         waiterPool.setMaxTotal(8);
         waiterPool.setTestOnBorrow(true);
@@ -1399,9 +1399,9 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
     @Test(timeout=60000)
     public void testClearOldest() throws Exception {
         // Make destroy have some latency so clearOldest takes some time
-        final WaiterFactory<String> waiterFactory = new WaiterFactory<String>(0, 20, 0, 0, 0, 0, 50, 5, 0);
+        final WaiterFactory<String> waiterFactory = new WaiterFactory<>(0, 20, 0, 0, 0, 0, 50, 5, 0);
         final GenericKeyedObjectPool<String,Waiter> waiterPool =
-                new GenericKeyedObjectPool<String,Waiter>(waiterFactory);
+                new GenericKeyedObjectPool<>(waiterFactory);
         waiterPool.setMaxTotalPerKey(5);
         waiterPool.setMaxTotal(50);
         waiterPool.setLifo(false);
@@ -1417,7 +1417,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         // Now set up a race - one thread wants a new instance, triggering clearOldest
         // Other goes after an element on death row
         // See if we end up with dead man walking
-        final SimpleTestThread<Waiter> t2 = new SimpleTestThread<Waiter>(waiterPool, "51");
+        final SimpleTestThread<Waiter> t2 = new SimpleTestThread<>(waiterPool, "51");
         final Thread thread2 = new Thread(t2);
         thread2.start();  // Triggers clearOldest, killing all of the 0's and the 2 oldest 1's
         Thread.sleep(50); // Wait for clearOldest to kick off, but not long enough to reach the 1's
@@ -1541,7 +1541,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         final int nIterations = 60;
         final InvalidateThread[] threads = new InvalidateThread[nThreads];
         // Randomly generated list of distinct invalidation targets
-        final ArrayList<Integer> targets = new ArrayList<Integer>();
+        final ArrayList<Integer> targets = new ArrayList<>();
         final Random random = new Random();
         for (int j = 0; j < nIterations; j++) {
             // Get a random invalidation target
@@ -1573,10 +1573,10 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
     // POOL-259
     @Test
     public void testClientWaitStats() throws Exception {
-        final SimpleFactory<String> factory = new SimpleFactory<String>();
+        final SimpleFactory<String> factory = new SimpleFactory<>();
         // Give makeObject a little latency
         factory.setMakeLatency(200);
-        final GenericKeyedObjectPool<String, String> pool = new GenericKeyedObjectPool<String, String>(
+        final GenericKeyedObjectPool<String, String> pool = new GenericKeyedObjectPool<>(
                 factory, new GenericKeyedObjectPoolConfig());
         final String s = pool.borrowObject("one");
         // First borrow waits on create, so wait time should be at least 200 ms
@@ -1834,7 +1834,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
                 }
                 out = String.valueOf(key) + String.valueOf(counter++);
             }
-            return new DefaultPooledObject<String>(out);
+            return new DefaultPooledObject<>(out);
         }
         @Override
         public void destroyObject(final K key, final PooledObject<String> obj) throws Exception {
@@ -1997,7 +1997,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         config.setTimeBetweenEvictionRunsMillis(-1);
 
         final GenericKeyedObjectPool<Integer, Object> pool =
-                new GenericKeyedObjectPool<Integer, Object>(
+                new GenericKeyedObjectPool<>(
                         new ObjectFactory(), config);
 
         // Allocate both objects with this thread
@@ -2065,8 +2065,8 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
     @Test
     public void testInvalidateFreesCapacity()
         throws Exception {
-        final SimpleFactory<String> factory = new SimpleFactory<String>();
-        final GenericKeyedObjectPool<String, String> pool = new GenericKeyedObjectPool<String, String>(factory);
+        final SimpleFactory<String> factory = new SimpleFactory<>();
+        final GenericKeyedObjectPool<String, String> pool = new GenericKeyedObjectPool<>(factory);
         pool.setMaxTotalPerKey(2);
         pool.setMaxWaitMillis(500);
         // Borrow an instance and hold if for 5 seconds
@@ -2097,10 +2097,10 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
     @Test
     public void testValidationFailureOnReturnFreesCapacity()
         throws Exception {
-        final SimpleFactory<String> factory = new SimpleFactory<String>();
+        final SimpleFactory<String> factory = new SimpleFactory<>();
         factory.setValid(false); // Validate will always fail
         factory.setValidationEnabled(true);
-        final GenericKeyedObjectPool<String, String> pool = new GenericKeyedObjectPool<String, String>(factory);
+        final GenericKeyedObjectPool<String, String> pool = new GenericKeyedObjectPool<>(factory);
         pool.setMaxTotalPerKey(2);
         pool.setMaxWaitMillis(1500);
         pool.setTestOnReturn(true);
@@ -2127,8 +2127,8 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
     @Test
     public void testMakeObjectException()
         throws Exception {
-        final SimpleFactory<String> factory = new SimpleFactory<String>();
-        final GenericKeyedObjectPool<String, String> pool = new GenericKeyedObjectPool<String, String>(factory);
+        final SimpleFactory<String> factory = new SimpleFactory<>();
+        final GenericKeyedObjectPool<String, String> pool = new GenericKeyedObjectPool<>(factory);
         pool.setMaxTotalPerKey(1);
         pool.setBlockWhenExhausted(false);
         factory.exceptionOnCreate = true;
@@ -2151,10 +2151,10 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
      */
     @Test
     public void testReturnToHead() throws Exception {
-        final SimpleFactory<String> factory = new SimpleFactory<String>();
+        final SimpleFactory<String> factory = new SimpleFactory<>();
         factory.setValidateLatency(100);
         factory.setValid(true);  // Validation always succeeds
-        final GenericKeyedObjectPool<String, String> pool = new GenericKeyedObjectPool<String, String>(factory);
+        final GenericKeyedObjectPool<String, String> pool = new GenericKeyedObjectPool<>(factory);
         pool.setMaxWaitMillis(1000);
         pool.setTestWhileIdle(true);
         pool.setMaxTotalPerKey(2);
@@ -2189,7 +2189,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
     public void testEqualsIndiscernible() throws Exception {
         final HashSetFactory factory = new HashSetFactory();
         final GenericKeyedObjectPool<String,HashSet<String>> pool =
-                new GenericKeyedObjectPool<String, HashSet<String>>(
+                new GenericKeyedObjectPool<>(
                         factory, new GenericKeyedObjectPoolConfig());
         final HashSet<String> s1 = pool.borrowObject("a");
         final HashSet<String> s2 = pool.borrowObject("a");
@@ -2208,7 +2208,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
     public void testMutable() throws Exception {
         final HashSetFactory factory = new HashSetFactory();
         final GenericKeyedObjectPool<String,HashSet<String>> pool =
-                new GenericKeyedObjectPool<String, HashSet<String>>(
+                new GenericKeyedObjectPool<>(
                         factory, new GenericKeyedObjectPoolConfig());
         final HashSet<String> s1 = pool.borrowObject("a");
         final HashSet<String> s2 = pool.borrowObject("a");
@@ -2227,9 +2227,9 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
      */
     @Test
     public void testMultipleReturn() throws Exception {
-        final WaiterFactory<String> factory = new WaiterFactory<String>(0, 0, 0, 0, 0, 0);
+        final WaiterFactory<String> factory = new WaiterFactory<>(0, 0, 0, 0, 0, 0);
         final GenericKeyedObjectPool<String, Waiter> pool =
-                new GenericKeyedObjectPool<String, Waiter>(factory);
+                new GenericKeyedObjectPool<>(factory);
         pool.setTestOnReturn(true);
         final Waiter waiter = pool.borrowObject("a");
         pool.returnObject("a",waiter);
@@ -2259,8 +2259,8 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
 
         final int holdTime = 2000;
 
-        final TestThread<String> testA = new TestThread<String>(pool, 1, 0, holdTime, false, null, "a");
-        final TestThread<String> testB = new TestThread<String>(pool, 1, 0, holdTime, false, null, "b");
+        final TestThread<String> testA = new TestThread<>(pool, 1, 0, holdTime, false, null, "a");
+        final TestThread<String> testB = new TestThread<>(pool, 1, 0, holdTime, false, null, "b");
 
         final Thread threadA = new Thread(testA);
         final Thread threadB = new Thread(testB);
@@ -2295,7 +2295,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         }
         @Override
         public PooledObject<Object> wrap(final Object value) {
-            return new DefaultPooledObject<Object>(value);
+            return new DefaultPooledObject<>(value);
         }
     }
 
@@ -2308,18 +2308,18 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
             extends BaseKeyedPooledObjectFactory<String, HashSet<String>> {
         @Override
         public HashSet<String> create(final String key) throws Exception {
-            return new HashSet<String>();
+            return new HashSet<>();
         }
         @Override
         public PooledObject<HashSet<String>> wrap(final HashSet<String> value) {
-            return new DefaultPooledObject<HashSet<String>>(value);
+            return new DefaultPooledObject<>(value);
         }
     }
 
     private static class SimplePerKeyFactory
             extends BaseKeyedPooledObjectFactory<Object,Object> {
         ConcurrentHashMap<Object,AtomicInteger> map =
-                new ConcurrentHashMap<Object,AtomicInteger>();
+                new ConcurrentHashMap<>();
         @Override
         public Object create(final Object key) throws Exception {
             int counter = 0;
@@ -2334,7 +2334,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         }
         @Override
         public PooledObject<Object> wrap(final Object value) {
-            return new DefaultPooledObject<Object>(value);
+            return new DefaultPooledObject<>(value);
         }
     }
 
@@ -2349,7 +2349,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
 
         @Override
         public PooledObject<Object> wrap(final Object value) {
-            return new DefaultPooledObject<Object>(value);
+            return new DefaultPooledObject<>(value);
         }
     }
 }


Mime
View raw message