Modified: 
websites/production/commons/content/proper/commons-pool/jacoco/org.apache.commons.pool2.impl/GenericObjectPool.java.html
==============================================================================
--- 
websites/production/commons/content/proper/commons-pool/jacoco/org.apache.commons.pool2.impl/GenericObjectPool.java.html
 (original)
+++ 
websites/production/commons/content/proper/commons-pool/jacoco/org.apache.commons.pool2.impl/GenericObjectPool.java.html
 Tue Sep 29 15:33:18 2020
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.pool2.impl;
 
+import org.apache.commons.pool2.DestroyMode;
 import org.apache.commons.pool2.ObjectPool;
 import org.apache.commons.pool2.PoolUtils;
 import org.apache.commons.pool2.PooledObject;
@@ -90,8 +91,8 @@ public class GenericObjectPool<T>
      *                used by this pool
      */
     public GenericObjectPool(final PooledObjectFactory<T> factory) {
-<span class="fc" id="L93">        this(factory, new 
GenericObjectPoolConfig&lt;T&gt;());</span>
-<span class="fc" id="L94">    }</span>
+<span class="fc" id="L94">        this(factory, new 
GenericObjectPoolConfig&lt;T&gt;());</span>
+<span class="fc" id="L95">    }</span>
 
     /**
      * Creates a new {@code GenericObjectPool} using a specific
@@ -107,18 +108,18 @@ public class GenericObjectPool&lt;T&gt;
     public GenericObjectPool(final PooledObjectFactory&lt;T&gt; factory,
             final GenericObjectPoolConfig&lt;T&gt; config) {
 
-<span class="fc" id="L110">        super(config, ONAME_BASE, 
config.getJmxNamePrefix());</span>
+<span class="fc" id="L111">        super(config, ONAME_BASE, 
config.getJmxNamePrefix());</span>
 
-<span class="fc bfc" id="L112" title="All 2 branches covered.">        if 
(factory == null) {</span>
-<span class="fc" id="L113">            jmxUnregister(); // tidy up</span>
-<span class="fc" id="L114">            throw new 
IllegalArgumentException(&quot;factory may not be null&quot;);</span>
+<span class="fc bfc" id="L113" title="All 2 branches covered.">        if 
(factory == null) {</span>
+<span class="fc" id="L114">            jmxUnregister(); // tidy up</span>
+<span class="fc" id="L115">            throw new 
IllegalArgumentException(&quot;factory may not be null&quot;);</span>
         }
-<span class="fc" id="L116">        this.factory = factory;</span>
+<span class="fc" id="L117">        this.factory = factory;</span>
 
-<span class="fc" id="L118">        idleObjects = new 
LinkedBlockingDeque&lt;&gt;(config.getFairness());</span>
+<span class="fc" id="L119">        idleObjects = new 
LinkedBlockingDeque&lt;&gt;(config.getFairness());</span>
 
-<span class="fc" id="L120">        setConfig(config);</span>
-<span class="fc" id="L121">    }</span>
+<span class="fc" id="L121">        setConfig(config);</span>
+<span class="fc" id="L122">    }</span>
 
     /**
      * Creates a new {@code GenericObjectPool} that tracks and destroys
@@ -135,9 +136,9 @@ public class GenericObjectPool&lt;T&gt;
      */
     public GenericObjectPool(final PooledObjectFactory&lt;T&gt; factory,
             final GenericObjectPoolConfig&lt;T&gt; config, final 
AbandonedConfig abandonedConfig) {
-<span class="fc" id="L138">        this(factory, config);</span>
-<span class="fc" id="L139">        setAbandonedConfig(abandonedConfig);</span>
-<span class="fc" id="L140">    }</span>
+<span class="fc" id="L139">        this(factory, config);</span>
+<span class="fc" id="L140">        setAbandonedConfig(abandonedConfig);</span>
+<span class="fc" id="L141">    }</span>
 
     /**
      * Returns the cap on the number of &quot;idle&quot; instances in the 
pool. If maxIdle
@@ -155,7 +156,7 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public int getMaxIdle() {
-<span class="fc" id="L158">        return maxIdle;</span>
+<span class="fc" id="L159">        return maxIdle;</span>
     }
 
     /**
@@ -175,8 +176,8 @@ public class GenericObjectPool&lt;T&gt;
      * @see #getMaxIdle
      */
     public void setMaxIdle(final int maxIdle) {
-<span class="fc" id="L178">        this.maxIdle = maxIdle;</span>
-<span class="fc" id="L179">    }</span>
+<span class="fc" id="L179">        this.maxIdle = maxIdle;</span>
+<span class="fc" id="L180">    }</span>
 
     /**
      * Sets the target for the minimum number of idle objects to maintain in
@@ -197,8 +198,8 @@ public class GenericObjectPool&lt;T&gt;
      * @see #getTimeBetweenEvictionRunsMillis()
      */
     public void setMinIdle(final int minIdle) {
-<span class="fc" id="L200">        this.minIdle = minIdle;</span>
-<span class="fc" id="L201">    }</span>
+<span class="fc" id="L201">        this.minIdle = minIdle;</span>
+<span class="fc" id="L202">    }</span>
 
     /**
      * Returns the target for the minimum number of idle objects to maintain in
@@ -219,11 +220,11 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public int getMinIdle() {
-<span class="fc" id="L222">        final int maxIdleSave = getMaxIdle();</span>
-<span class="fc bfc" id="L223" title="All 2 branches covered.">        if 
(this.minIdle &gt; maxIdleSave) {</span>
-<span class="fc" id="L224">            return maxIdleSave;</span>
+<span class="fc" id="L223">        final int maxIdleSave = getMaxIdle();</span>
+<span class="fc bfc" id="L224" title="All 2 branches covered.">        if 
(this.minIdle &gt; maxIdleSave) {</span>
+<span class="fc" id="L225">            return maxIdleSave;</span>
         }
-<span class="fc" id="L226">        return minIdle;</span>
+<span class="fc" id="L227">        return minIdle;</span>
     }
 
     /**
@@ -234,7 +235,7 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public boolean isAbandonedConfig() {
-<span class="pc bpc" id="L237" title="1 of 2 branches missed.">        return 
abandonedConfig != null;</span>
+<span class="pc bpc" id="L238" title="1 of 2 branches missed.">        return 
abandonedConfig != null;</span>
     }
 
     /**
@@ -247,8 +248,8 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public boolean getLogAbandoned() {
-<span class="nc" id="L250">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
-<span class="nc bnc" id="L251" title="All 4 branches missed.">        return 
ac != null &amp;&amp; ac.getLogAbandoned();</span>
+<span class="nc" id="L251">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
+<span class="nc bnc" id="L252" title="All 4 branches missed.">        return 
ac != null &amp;&amp; ac.getLogAbandoned();</span>
     }
 
     /**
@@ -262,8 +263,8 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public boolean getRemoveAbandonedOnBorrow() {
-<span class="nc" id="L265">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
-<span class="nc bnc" id="L266" title="All 4 branches missed.">        return 
ac != null &amp;&amp; ac.getRemoveAbandonedOnBorrow();</span>
+<span class="nc" id="L266">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
+<span class="nc bnc" id="L267" title="All 4 branches missed.">        return 
ac != null &amp;&amp; ac.getRemoveAbandonedOnBorrow();</span>
     }
 
     /**
@@ -276,8 +277,8 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public boolean getRemoveAbandonedOnMaintenance() {
-<span class="nc" id="L279">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
-<span class="nc bnc" id="L280" title="All 4 branches missed.">        return 
ac != null &amp;&amp; ac.getRemoveAbandonedOnMaintenance();</span>
+<span class="nc" id="L280">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
+<span class="nc bnc" id="L281" title="All 4 branches missed.">        return 
ac != null &amp;&amp; ac.getRemoveAbandonedOnMaintenance();</span>
     }
 
     /**
@@ -291,8 +292,8 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public int getRemoveAbandonedTimeout() {
-<span class="nc" id="L294">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
-<span class="nc bnc" id="L295" title="All 2 branches missed.">        return 
ac != null ? ac.getRemoveAbandonedTimeout() : Integer.MAX_VALUE;</span>
+<span class="nc" id="L295">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
+<span class="nc bnc" id="L296" title="All 2 branches missed.">        return 
ac != null ? ac.getRemoveAbandonedTimeout() : Integer.MAX_VALUE;</span>
     }
 
 
@@ -304,11 +305,11 @@ public class GenericObjectPool&lt;T&gt;
      * @see GenericObjectPoolConfig
      */
     public void setConfig(final GenericObjectPoolConfig&lt;T&gt; conf) {
-<span class="fc" id="L307">        super.setConfig(conf);</span>
-<span class="fc" id="L308">        setMaxIdle(conf.getMaxIdle());</span>
-<span class="fc" id="L309">        setMinIdle(conf.getMinIdle());</span>
-<span class="fc" id="L310">        setMaxTotal(conf.getMaxTotal());</span>
-<span class="fc" id="L311">    }</span>
+<span class="fc" id="L308">        super.setConfig(conf);</span>
+<span class="fc" id="L309">        setMaxIdle(conf.getMaxIdle());</span>
+<span class="fc" id="L310">        setMinIdle(conf.getMinIdle());</span>
+<span class="fc" id="L311">        setMaxTotal(conf.getMaxTotal());</span>
+<span class="fc" id="L312">    }</span>
 
     /**
      * Sets the abandoned object removal configuration.
@@ -317,20 +318,21 @@ public class GenericObjectPool&lt;T&gt;
      *
      * @see AbandonedConfig
      */
+    @SuppressWarnings(&quot;resource&quot;) // PrintWriter is managed elsewhere
     public void setAbandonedConfig(final AbandonedConfig abandonedConfig) {
-<span class="pc bpc" id="L321" title="1 of 2 branches missed.">        if 
(abandonedConfig == null) {</span>
-<span class="nc" id="L322">            this.abandonedConfig = null;</span>
+<span class="pc bpc" id="L323" title="1 of 2 branches missed.">        if 
(abandonedConfig == null) {</span>
+<span class="nc" id="L324">            this.abandonedConfig = null;</span>
         } else {
-<span class="fc" id="L324">            this.abandonedConfig = new 
AbandonedConfig();</span>
-<span class="fc" id="L325">            
this.abandonedConfig.setLogAbandoned(abandonedConfig.getLogAbandoned());</span>
-<span class="fc" id="L326">            
this.abandonedConfig.setLogWriter(abandonedConfig.getLogWriter());</span>
-<span class="fc" id="L327">            
this.abandonedConfig.setRemoveAbandonedOnBorrow(abandonedConfig.getRemoveAbandonedOnBorrow());</span>
-<span class="fc" id="L328">            
this.abandonedConfig.setRemoveAbandonedOnMaintenance(abandonedConfig.getRemoveAbandonedOnMaintenance());</span>
-<span class="fc" id="L329">            
this.abandonedConfig.setRemoveAbandonedTimeout(abandonedConfig.getRemoveAbandonedTimeout());</span>
-<span class="fc" id="L330">            
this.abandonedConfig.setUseUsageTracking(abandonedConfig.getUseUsageTracking());</span>
-<span class="fc" id="L331">            
this.abandonedConfig.setRequireFullStackTrace(abandonedConfig.getRequireFullStackTrace());</span>
+<span class="fc" id="L326">            this.abandonedConfig = new 
AbandonedConfig();</span>
+<span class="fc" id="L327">            
this.abandonedConfig.setLogAbandoned(abandonedConfig.getLogAbandoned());</span>
+<span class="fc" id="L328">            
this.abandonedConfig.setLogWriter(abandonedConfig.getLogWriter());</span>
+<span class="fc" id="L329">            
this.abandonedConfig.setRemoveAbandonedOnBorrow(abandonedConfig.getRemoveAbandonedOnBorrow());</span>
+<span class="fc" id="L330">            
this.abandonedConfig.setRemoveAbandonedOnMaintenance(abandonedConfig.getRemoveAbandonedOnMaintenance());</span>
+<span class="fc" id="L331">            
this.abandonedConfig.setRemoveAbandonedTimeout(abandonedConfig.getRemoveAbandonedTimeout());</span>
+<span class="fc" id="L332">            
this.abandonedConfig.setUseUsageTracking(abandonedConfig.getUseUsageTracking());</span>
+<span class="fc" id="L333">            
this.abandonedConfig.setRequireFullStackTrace(abandonedConfig.getRequireFullStackTrace());</span>
         }
-<span class="fc" id="L333">    }</span>
+<span class="fc" id="L335">    }</span>
 
     /**
      * Obtains a reference to the factory used to create, destroy and validate
@@ -339,7 +341,7 @@ public class GenericObjectPool&lt;T&gt;
      * @return the factory
      */
     public PooledObjectFactory&lt;T&gt; getFactory() {
-<span class="nc" id="L342">        return factory;</span>
+<span class="nc" id="L344">        return factory;</span>
     }
 
     /**
@@ -351,7 +353,7 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public T borrowObject() throws Exception {
-<span class="fc" id="L354">        return 
borrowObject(getMaxWaitMillis());</span>
+<span class="fc" id="L356">        return 
borrowObject(getMaxWaitMillis());</span>
     }
 
     /**
@@ -404,103 +406,103 @@ public class GenericObjectPool&lt;T&gt;
      *                   error
      */
     public T borrowObject(final long borrowMaxWaitMillis) throws Exception {
-<span class="fc" id="L407">        assertOpen();</span>
+<span class="fc" id="L409">        assertOpen();</span>
 
-<span class="fc" id="L409">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
-<span class="fc bfc" id="L410" title="All 4 branches covered.">        if (ac 
!= null &amp;&amp; ac.getRemoveAbandonedOnBorrow() &amp;&amp;</span>
-<span class="pc bpc" id="L411" title="1 of 2 branches missed.">                
(getNumIdle() &lt; 2) &amp;&amp;</span>
-<span class="fc bfc" id="L412" title="All 2 branches covered.">                
(getNumActive() &gt; getMaxTotal() - 3) ) {</span>
-<span class="fc" id="L413">            removeAbandoned(ac);</span>
+<span class="fc" id="L411">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
+<span class="fc bfc" id="L412" title="All 4 branches covered.">        if (ac 
!= null &amp;&amp; ac.getRemoveAbandonedOnBorrow() &amp;&amp;</span>
+<span class="pc bpc" id="L413" title="1 of 2 branches missed.">                
(getNumIdle() &lt; 2) &amp;&amp;</span>
+<span class="fc bfc" id="L414" title="All 2 branches covered.">                
(getNumActive() &gt; getMaxTotal() - 3) ) {</span>
+<span class="fc" id="L415">            removeAbandoned(ac);</span>
         }
 
-<span class="fc" id="L416">        PooledObject&lt;T&gt; p = null;</span>
+<span class="fc" id="L418">        PooledObject&lt;T&gt; p = null;</span>
 
         // Get local copy of current config so it is consistent for entire
         // method execution
-<span class="fc" id="L420">        final boolean blockWhenExhausted = 
getBlockWhenExhausted();</span>
+<span class="fc" id="L422">        final boolean blockWhenExhausted = 
getBlockWhenExhausted();</span>
 
         boolean create;
-<span class="fc" id="L423">        final long waitTime = 
System.currentTimeMillis();</span>
+<span class="fc" id="L425">        final long waitTime = 
System.currentTimeMillis();</span>
 
-<span class="fc bfc" id="L425" title="All 2 branches covered.">        while 
(p == null) {</span>
-<span class="fc" id="L426">            create = false;</span>
-<span class="fc" id="L427">            p = idleObjects.pollFirst();</span>
-<span class="fc bfc" id="L428" title="All 2 branches covered.">            if 
(p == null) {</span>
-<span class="fc" id="L429">                p = create();</span>
-<span class="fc bfc" id="L430" title="All 2 branches covered.">                
if (p != null) {</span>
-<span class="fc" id="L431">                    create = true;</span>
+<span class="fc bfc" id="L427" title="All 2 branches covered.">        while 
(p == null) {</span>
+<span class="fc" id="L428">            create = false;</span>
+<span class="fc" id="L429">            p = idleObjects.pollFirst();</span>
+<span class="fc bfc" id="L430" title="All 2 branches covered.">            if 
(p == null) {</span>
+<span class="fc" id="L431">                p = create();</span>
+<span class="fc bfc" id="L432" title="All 2 branches covered.">                
if (p != null) {</span>
+<span class="fc" id="L433">                    create = true;</span>
                 }
             }
-<span class="fc bfc" id="L434" title="All 2 branches covered.">            if 
(blockWhenExhausted) {</span>
-<span class="fc bfc" id="L435" title="All 2 branches covered.">                
if (p == null) {</span>
-<span class="fc bfc" id="L436" title="All 2 branches covered.">                
    if (borrowMaxWaitMillis &lt; 0) {</span>
-<span class="fc" id="L437">                        p = 
idleObjects.takeFirst();</span>
+<span class="fc bfc" id="L436" title="All 2 branches covered.">            if 
(blockWhenExhausted) {</span>
+<span class="fc bfc" id="L437" title="All 2 branches covered.">                
if (p == null) {</span>
+<span class="fc bfc" id="L438" title="All 2 branches covered.">                
    if (borrowMaxWaitMillis &lt; 0) {</span>
+<span class="fc" id="L439">                        p = 
idleObjects.takeFirst();</span>
                     } else {
-<span class="fc" id="L439">                        p = 
idleObjects.pollFirst(borrowMaxWaitMillis,</span>
+<span class="fc" id="L441">                        p = 
idleObjects.pollFirst(borrowMaxWaitMillis,</span>
                                 TimeUnit.MILLISECONDS);
                     }
                 }
-<span class="fc bfc" id="L443" title="All 2 branches covered.">                
if (p == null) {</span>
-<span class="fc" id="L444">                    throw new 
NoSuchElementException(</span>
+<span class="fc bfc" id="L445" title="All 2 branches covered.">                
if (p == null) {</span>
+<span class="fc" id="L446">                    throw new 
NoSuchElementException(</span>
                             &quot;Timeout waiting for idle object&quot;);
                 }
             } else {
-<span class="fc bfc" id="L448" title="All 2 branches covered.">                
if (p == null) {</span>
-<span class="fc" id="L449">                    throw new 
NoSuchElementException(&quot;Pool exhausted&quot;);</span>
+<span class="fc bfc" id="L450" title="All 2 branches covered.">                
if (p == null) {</span>
+<span class="fc" id="L451">                    throw new 
NoSuchElementException(&quot;Pool exhausted&quot;);</span>
                 }
             }
-<span class="fc bfc" id="L452" title="All 2 branches covered.">            if 
(!p.allocate()) {</span>
-<span class="fc" id="L453">                p = null;</span>
+<span class="fc bfc" id="L454" title="All 2 branches covered.">            if 
(!p.allocate()) {</span>
+<span class="fc" id="L455">                p = null;</span>
             }
 
-<span class="fc bfc" id="L456" title="All 2 branches covered.">            if 
(p != null) {</span>
+<span class="fc bfc" id="L458" title="All 2 branches covered.">            if 
(p != null) {</span>
                 try {
-<span class="fc" id="L458">                    
factory.activateObject(p);</span>
-<span class="fc" id="L459">                } catch (final Exception e) {</span>
+<span class="fc" id="L460">                    
factory.activateObject(p);</span>
+<span class="fc" id="L461">                } catch (final Exception e) {</span>
                     try {
-<span class="fc" id="L461">                        destroy(p);</span>
-<span class="nc" id="L462">                    } catch (final Exception e1) 
{</span>
+<span class="fc" id="L463">                        destroy(p, 
DestroyMode.NORMAL);</span>
+<span class="nc" id="L464">                    } catch (final Exception e1) 
{</span>
                         // Ignore - activation failure is more important
-<span class="fc" id="L464">                    }</span>
-<span class="fc" id="L465">                    p = null;</span>
-<span class="fc bfc" id="L466" title="All 2 branches covered.">                
    if (create) {</span>
-<span class="fc" id="L467">                        final 
NoSuchElementException nsee = new NoSuchElementException(</span>
+<span class="fc" id="L466">                    }</span>
+<span class="fc" id="L467">                    p = null;</span>
+<span class="fc bfc" id="L468" title="All 2 branches covered.">                
    if (create) {</span>
+<span class="fc" id="L469">                        final 
NoSuchElementException nsee = new NoSuchElementException(</span>
                                 &quot;Unable to activate object&quot;);
-<span class="fc" id="L469">                        nsee.initCause(e);</span>
-<span class="fc" id="L470">                        throw nsee;</span>
+<span class="fc" id="L471">                        nsee.initCause(e);</span>
+<span class="fc" id="L472">                        throw nsee;</span>
                     }
-<span class="fc" id="L472">                }</span>
-<span class="fc bfc" id="L473" title="All 4 branches covered.">                
if (p != null &amp;&amp; getTestOnBorrow()) {</span>
-<span class="fc" id="L474">                    boolean validate = false;</span>
-<span class="fc" id="L475">                    Throwable validationThrowable = 
null;</span>
+<span class="fc" id="L474">                }</span>
+<span class="fc bfc" id="L475" title="All 4 branches covered.">                
if (p != null &amp;&amp; getTestOnBorrow()) {</span>
+<span class="fc" id="L476">                    boolean validate = false;</span>
+<span class="fc" id="L477">                    Throwable validationThrowable = 
null;</span>
                     try {
-<span class="fc" id="L477">                        validate = 
factory.validateObject(p);</span>
-<span class="fc" id="L478">                    } catch (final Throwable t) 
{</span>
-<span class="fc" id="L479">                        
PoolUtils.checkRethrow(t);</span>
-<span class="fc" id="L480">                        validationThrowable = 
t;</span>
-<span class="fc" id="L481">                    }</span>
-<span class="fc bfc" id="L482" title="All 2 branches covered.">                
    if (!validate) {</span>
+<span class="fc" id="L479">                        validate = 
factory.validateObject(p);</span>
+<span class="fc" id="L480">                    } catch (final Throwable t) 
{</span>
+<span class="fc" id="L481">                        
PoolUtils.checkRethrow(t);</span>
+<span class="fc" id="L482">                        validationThrowable = 
t;</span>
+<span class="fc" id="L483">                    }</span>
+<span class="fc bfc" id="L484" title="All 2 branches covered.">                
    if (!validate) {</span>
                         try {
-<span class="fc" id="L484">                            destroy(p);</span>
-<span class="fc" id="L485">                            
destroyedByBorrowValidationCount.incrementAndGet();</span>
-<span class="fc" id="L486">                        } catch (final Exception e) 
{</span>
+<span class="fc" id="L486">                            destroy(p, 
DestroyMode.NORMAL);</span>
+<span class="fc" id="L487">                            
destroyedByBorrowValidationCount.incrementAndGet();</span>
+<span class="fc" id="L488">                        } catch (final Exception e) 
{</span>
                             // Ignore - validation failure is more important
-<span class="fc" id="L488">                        }</span>
-<span class="fc" id="L489">                        p = null;</span>
-<span class="fc bfc" id="L490" title="All 2 branches covered.">                
        if (create) {</span>
-<span class="fc" id="L491">                            final 
NoSuchElementException nsee = new NoSuchElementException(</span>
+<span class="fc" id="L490">                        }</span>
+<span class="fc" id="L491">                        p = null;</span>
+<span class="fc bfc" id="L492" title="All 2 branches covered.">                
        if (create) {</span>
+<span class="fc" id="L493">                            final 
NoSuchElementException nsee = new NoSuchElementException(</span>
                                     &quot;Unable to validate object&quot;);
-<span class="fc" id="L493">                            
nsee.initCause(validationThrowable);</span>
-<span class="fc" id="L494">                            throw nsee;</span>
+<span class="fc" id="L495">                            
nsee.initCause(validationThrowable);</span>
+<span class="fc" id="L496">                            throw nsee;</span>
                         }
                     }
-<span class="fc" id="L497">                }</span>
+<span class="fc" id="L499">                }</span>
             }
         }
 
-<span class="fc" id="L501">        updateStatsBorrow(p, 
System.currentTimeMillis() - waitTime);</span>
+<span class="fc" id="L503">        updateStatsBorrow(p, 
System.currentTimeMillis() - waitTime);</span>
 
-<span class="fc" id="L503">        return p.getObject();</span>
+<span class="fc" id="L505">        return p.getObject();</span>
     }
 
     /**
@@ -522,91 +524,91 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public void returnObject(final T obj) {
-<span class="fc" id="L525">        final PooledObject&lt;T&gt; p = 
allObjects.get(new IdentityWrapper&lt;&gt;(obj));</span>
+<span class="fc" id="L527">        final PooledObject&lt;T&gt; p = 
allObjects.get(new IdentityWrapper&lt;&gt;(obj));</span>
 
-<span class="pc bpc" id="L527" title="1 of 2 branches missed.">        if (p 
== null) {</span>
-<span class="nc bnc" id="L528" title="All 2 branches missed.">            if 
(!isAbandonedConfig()) {</span>
-<span class="nc" id="L529">                throw new 
IllegalStateException(</span>
+<span class="pc bpc" id="L529" title="1 of 2 branches missed.">        if (p 
== null) {</span>
+<span class="nc bnc" id="L530" title="All 2 branches missed.">            if 
(!isAbandonedConfig()) {</span>
+<span class="nc" id="L531">                throw new 
IllegalStateException(</span>
                         &quot;Returned object not currently part of this 
pool&quot;);
             }
-<span class="nc" id="L532">            return; // Object was abandoned and 
removed</span>
+<span class="nc" id="L534">            return; // Object was abandoned and 
removed</span>
         }
 
-<span class="fc" id="L535">        markReturningState(p);</span>
+<span class="fc" id="L537">        markReturningState(p);</span>
 
-<span class="fc" id="L537">        final long activeTime = 
p.getActiveTimeMillis();</span>
+<span class="fc" id="L539">        final long activeTime = 
p.getActiveTimeMillis();</span>
 
-<span class="fc bfc" id="L539" title="All 4 branches covered.">        if 
(getTestOnReturn() &amp;&amp; !factory.validateObject(p)) {</span>
+<span class="fc bfc" id="L541" title="All 4 branches covered.">        if 
(getTestOnReturn() &amp;&amp; !factory.validateObject(p)) {</span>
             try {
-<span class="fc" id="L541">                destroy(p);</span>
-<span class="fc" id="L542">            } catch (final Exception e) {</span>
-<span class="fc" id="L543">                swallowException(e);</span>
-<span class="fc" id="L544">            }</span>
+<span class="fc" id="L543">                destroy(p, 
DestroyMode.NORMAL);</span>
+<span class="fc" id="L544">            } catch (final Exception e) {</span>
+<span class="fc" id="L545">                swallowException(e);</span>
+<span class="fc" id="L546">            }</span>
             try {
-<span class="fc" id="L546">                ensureIdle(1, false);</span>
-<span class="nc" id="L547">            } catch (final Exception e) {</span>
-<span class="nc" id="L548">                swallowException(e);</span>
-<span class="fc" id="L549">            }</span>
-<span class="fc" id="L550">            updateStatsReturn(activeTime);</span>
-<span class="fc" id="L551">            return;</span>
+<span class="fc" id="L548">                ensureIdle(1, false);</span>
+<span class="nc" id="L549">            } catch (final Exception e) {</span>
+<span class="nc" id="L550">                swallowException(e);</span>
+<span class="fc" id="L551">            }</span>
+<span class="fc" id="L552">            updateStatsReturn(activeTime);</span>
+<span class="fc" id="L553">            return;</span>
         }
 
         try {
-<span class="fc" id="L555">            factory.passivateObject(p);</span>
-<span class="fc" id="L556">        } catch (final Exception e1) {</span>
-<span class="fc" id="L557">            swallowException(e1);</span>
+<span class="fc" id="L557">            factory.passivateObject(p);</span>
+<span class="fc" id="L558">        } catch (final Exception e1) {</span>
+<span class="fc" id="L559">            swallowException(e1);</span>
             try {
-<span class="fc" id="L559">                destroy(p);</span>
-<span class="fc" id="L560">            } catch (final Exception e) {</span>
-<span class="fc" id="L561">                swallowException(e);</span>
-<span class="fc" id="L562">            }</span>
+<span class="fc" id="L561">                destroy(p, 
DestroyMode.NORMAL);</span>
+<span class="fc" id="L562">            } catch (final Exception e) {</span>
+<span class="fc" id="L563">                swallowException(e);</span>
+<span class="fc" id="L564">            }</span>
             try {
-<span class="fc" id="L564">                ensureIdle(1, false);</span>
-<span class="nc" id="L565">            } catch (final Exception e) {</span>
-<span class="nc" id="L566">                swallowException(e);</span>
-<span class="fc" id="L567">            }</span>
-<span class="fc" id="L568">            updateStatsReturn(activeTime);</span>
-<span class="fc" id="L569">            return;</span>
-<span class="fc" id="L570">        }</span>
+<span class="fc" id="L566">                ensureIdle(1, false);</span>
+<span class="nc" id="L567">            } catch (final Exception e) {</span>
+<span class="nc" id="L568">                swallowException(e);</span>
+<span class="fc" id="L569">            }</span>
+<span class="fc" id="L570">            updateStatsReturn(activeTime);</span>
+<span class="fc" id="L571">            return;</span>
+<span class="fc" id="L572">        }</span>
 
-<span class="pc bpc" id="L572" title="1 of 2 branches missed.">        if 
(!p.deallocate()) {</span>
-<span class="nc" id="L573">            throw new IllegalStateException(</span>
+<span class="pc bpc" id="L574" title="1 of 2 branches missed.">        if 
(!p.deallocate()) {</span>
+<span class="nc" id="L575">            throw new IllegalStateException(</span>
                     &quot;Object has already been returned to this pool or is 
invalid&quot;);
         }
 
-<span class="fc" id="L577">        final int maxIdleSave = getMaxIdle();</span>
-<span class="fc bfc" id="L578" title="All 6 branches covered.">        if 
(isClosed() || maxIdleSave &gt; -1 &amp;&amp; maxIdleSave &lt;= 
idleObjects.size()) {</span>
+<span class="fc" id="L579">        final int maxIdleSave = getMaxIdle();</span>
+<span class="fc bfc" id="L580" title="All 6 branches covered.">        if 
(isClosed() || maxIdleSave &gt; -1 &amp;&amp; maxIdleSave &lt;= 
idleObjects.size()) {</span>
             try {
-<span class="fc" id="L580">                destroy(p);</span>
-<span class="nc" id="L581">            } catch (final Exception e) {</span>
-<span class="nc" id="L582">                swallowException(e);</span>
-<span class="fc" id="L583">            }</span>
+<span class="fc" id="L582">                destroy(p, 
DestroyMode.NORMAL);</span>
+<span class="nc" id="L583">            } catch (final Exception e) {</span>
+<span class="nc" id="L584">                swallowException(e);</span>
+<span class="fc" id="L585">            }</span>
             try {
-<span class="fc" id="L585">                ensureIdle(1, false);</span>
-<span class="nc" id="L586">            } catch (final Exception e) {</span>
-<span class="nc" id="L587">                swallowException(e);</span>
-<span class="pc" id="L588">            }</span>
+<span class="fc" id="L587">                ensureIdle(1, false);</span>
+<span class="nc" id="L588">            } catch (final Exception e) {</span>
+<span class="nc" id="L589">                swallowException(e);</span>
+<span class="pc" id="L590">            }</span>
         } else {
-<span class="fc bfc" id="L590" title="All 2 branches covered.">            if 
(getLifo()) {</span>
-<span class="fc" id="L591">                idleObjects.addFirst(p);</span>
+<span class="fc bfc" id="L592" title="All 2 branches covered.">            if 
(getLifo()) {</span>
+<span class="fc" id="L593">                idleObjects.addFirst(p);</span>
             } else {
-<span class="fc" id="L593">                idleObjects.addLast(p);</span>
+<span class="fc" id="L595">                idleObjects.addLast(p);</span>
             }
-<span class="pc bpc" id="L595" title="1 of 2 branches missed.">            if 
(isClosed()) {</span>
+<span class="pc bpc" id="L597" title="1 of 2 branches missed.">            if 
(isClosed()) {</span>
                 // Pool closed while object was being added to idle objects.
                 // Make sure the returned object is destroyed rather than left
                 // in the idle object pool (which would effectively be a leak)
-<span class="nc" id="L599">                clear();</span>
+<span class="nc" id="L601">                clear();</span>
             }
         }
-<span class="fc" id="L602">        updateStatsReturn(activeTime);</span>
-<span class="fc" id="L603">    }</span>
+<span class="fc" id="L604">        updateStatsReturn(activeTime);</span>
+<span class="fc" id="L605">    }</span>
 
     /**
      * {@inheritDoc}
      * &lt;p&gt;
      * Activation of this method decrements the active count and attempts to
-     * destroy the instance.
+     * destroy the instance, using the default (NORMAL) {@link DestroyMode}.
      * &lt;/p&gt;
      *
      * @throws Exception             if an exception occurs destroying the
@@ -615,21 +617,38 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public void invalidateObject(final T obj) throws Exception {
-<span class="fc" id="L618">        final PooledObject&lt;T&gt; p = 
allObjects.get(new IdentityWrapper&lt;&gt;(obj));</span>
-<span class="fc bfc" id="L619" title="All 2 branches covered.">        if (p 
== null) {</span>
-<span class="pc bpc" id="L620" title="1 of 2 branches missed.">            if 
(isAbandonedConfig()) {</span>
-<span class="nc" id="L621">                return;</span>
+<span class="fc" id="L620">        invalidateObject(obj, 
DestroyMode.NORMAL);</span>
+<span class="fc" id="L621">    }</span>
+
+    /**
+     * {@inheritDoc}
+     * &lt;p&gt;
+     * Activation of this method decrements the active count and attempts to
+     * destroy the instance, using the provided {@link DestroyMode}.
+     * &lt;/p&gt;
+     *
+     * @throws Exception             if an exception occurs destroying the
+     *                               object
+     * @throws IllegalStateException if obj does not belong to this pool
+     * @since 2.9.0
+     */
+    @Override
+    public void invalidateObject(final T obj, final DestroyMode mode) throws 
Exception {
+<span class="fc" id="L637">        final PooledObject&lt;T&gt; p = 
allObjects.get(new IdentityWrapper&lt;&gt;(obj));</span>
+<span class="fc bfc" id="L638" title="All 2 branches covered.">        if (p 
== null) {</span>
+<span class="pc bpc" id="L639" title="1 of 2 branches missed.">            if 
(isAbandonedConfig()) {</span>
+<span class="nc" id="L640">                return;</span>
             }
-<span class="fc" id="L623">            throw new IllegalStateException(</span>
+<span class="fc" id="L642">            throw new IllegalStateException(</span>
                     &quot;Invalidated object not currently part of this 
pool&quot;);
         }
-<span class="fc" id="L626">        synchronized (p) {</span>
-<span class="fc bfc" id="L627" title="All 2 branches covered.">            if 
(p.getState() != PooledObjectState.INVALID) {</span>
-<span class="fc" id="L628">                destroy(p);</span>
+<span class="fc" id="L645">        synchronized (p) {</span>
+<span class="fc bfc" id="L646" title="All 2 branches covered.">            if 
(p.getState() != PooledObjectState.INVALID) {</span>
+<span class="fc" id="L647">                destroy(p, mode);</span>
             }
-<span class="fc" id="L630">        }</span>
-<span class="fc" id="L631">        ensureIdle(1, false);</span>
-<span class="fc" id="L632">    }</span>
+<span class="fc" id="L649">        }</span>
+<span class="fc" id="L650">        ensureIdle(1, false);</span>
+<span class="fc" id="L651">    }</span>
 
     /**
      * Clears any objects sitting idle in the pool by removing them from the
@@ -651,26 +670,26 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public void clear() {
-<span class="fc" id="L654">        PooledObject&lt;T&gt; p = 
idleObjects.poll();</span>
+<span class="fc" id="L673">        PooledObject&lt;T&gt; p = 
idleObjects.poll();</span>
 
-<span class="fc bfc" id="L656" title="All 2 branches covered.">        while 
(p != null) {</span>
+<span class="fc bfc" id="L675" title="All 2 branches covered.">        while 
(p != null) {</span>
             try {
-<span class="fc" id="L658">                destroy(p);</span>
-<span class="fc" id="L659">            } catch (final Exception e) {</span>
-<span class="fc" id="L660">                swallowException(e);</span>
-<span class="fc" id="L661">            }</span>
-<span class="fc" id="L662">            p = idleObjects.poll();</span>
+<span class="fc" id="L677">                destroy(p, 
DestroyMode.NORMAL);</span>
+<span class="fc" id="L678">            } catch (final Exception e) {</span>
+<span class="fc" id="L679">                swallowException(e);</span>
+<span class="fc" id="L680">            }</span>
+<span class="fc" id="L681">            p = idleObjects.poll();</span>
         }
-<span class="fc" id="L664">    }</span>
+<span class="fc" id="L683">    }</span>
 
     @Override
     public int getNumActive() {
-<span class="fc" id="L668">        return allObjects.size() - 
idleObjects.size();</span>
+<span class="fc" id="L687">        return allObjects.size() - 
idleObjects.size();</span>
     }
 
     @Override
     public int getNumIdle() {
-<span class="fc" id="L673">        return idleObjects.size();</span>
+<span class="fc" id="L692">        return idleObjects.size();</span>
     }
 
     /**
@@ -684,29 +703,29 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public void close() {
-<span class="fc bfc" id="L687" title="All 2 branches covered.">        if 
(isClosed()) {</span>
-<span class="fc" id="L688">            return;</span>
+<span class="fc bfc" id="L706" title="All 2 branches covered.">        if 
(isClosed()) {</span>
+<span class="fc" id="L707">            return;</span>
         }
 
-<span class="fc" id="L691">        synchronized (closeLock) {</span>
-<span class="pc bpc" id="L692" title="1 of 2 branches missed.">            if 
(isClosed()) {</span>
-<span class="nc" id="L693">                return;</span>
+<span class="fc" id="L710">        synchronized (closeLock) {</span>
+<span class="pc bpc" id="L711" title="1 of 2 branches missed.">            if 
(isClosed()) {</span>
+<span class="nc" id="L712">                return;</span>
             }
 
             // Stop the evictor before the pool is closed since evict() calls
             // assertOpen()
-<span class="fc" id="L698">            stopEvictor();</span>
+<span class="fc" id="L717">            stopEvictor();</span>
 
-<span class="fc" id="L700">            closed = true;</span>
+<span class="fc" id="L719">            closed = true;</span>
             // This clear removes any idle objects
-<span class="fc" id="L702">            clear();</span>
+<span class="fc" id="L721">            clear();</span>
 
-<span class="fc" id="L704">            jmxUnregister();</span>
+<span class="fc" id="L723">            jmxUnregister();</span>
 
             // Release any threads that were waiting for an object
-<span class="fc" id="L707">            
idleObjects.interuptTakeWaiters();</span>
-<span class="fc" id="L708">        }</span>
-<span class="fc" id="L709">    }</span>
+<span class="fc" id="L726">            
idleObjects.interuptTakeWaiters();</span>
+<span class="fc" id="L727">        }</span>
+<span class="fc" id="L728">    }</span>
 
     /**
      * {@inheritDoc}
@@ -717,45 +736,45 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public void evict() throws Exception {
-<span class="fc" id="L720">        assertOpen();</span>
+<span class="fc" id="L739">        assertOpen();</span>
 
-<span class="fc bfc" id="L722" title="All 2 branches covered.">        if 
(idleObjects.size() &gt; 0) {</span>
+<span class="fc bfc" id="L741" title="All 2 branches covered.">        if 
(idleObjects.size() &gt; 0) {</span>
 
-<span class="fc" id="L724">            PooledObject&lt;T&gt; underTest = 
null;</span>
-<span class="fc" id="L725">            final EvictionPolicy&lt;T&gt; 
evictionPolicy = getEvictionPolicy();</span>
+<span class="fc" id="L743">            PooledObject&lt;T&gt; underTest = 
null;</span>
+<span class="fc" id="L744">            final EvictionPolicy&lt;T&gt; 
evictionPolicy = getEvictionPolicy();</span>
 
-<span class="fc" id="L727">            synchronized (evictionLock) {</span>
-<span class="fc" id="L728">                final EvictionConfig evictionConfig 
= new EvictionConfig(</span>
-<span class="fc" id="L729">                        
getMinEvictableIdleTimeMillis(),</span>
-<span class="fc" id="L730">                        
getSoftMinEvictableIdleTimeMillis(),</span>
-<span class="fc" id="L731">                        getMinIdle());</span>
+<span class="fc" id="L746">            synchronized (evictionLock) {</span>
+<span class="fc" id="L747">                final EvictionConfig evictionConfig 
= new EvictionConfig(</span>
+<span class="fc" id="L748">                        
getMinEvictableIdleTimeMillis(),</span>
+<span class="fc" id="L749">                        
getSoftMinEvictableIdleTimeMillis(),</span>
+<span class="fc" id="L750">                        getMinIdle());</span>
 
-<span class="fc" id="L733">                final boolean testWhileIdle = 
getTestWhileIdle();</span>
+<span class="fc" id="L752">                final boolean testWhileIdle = 
getTestWhileIdle();</span>
 
-<span class="fc bfc" id="L735" title="All 2 branches covered.">                
for (int i = 0, m = getNumTests(); i &lt; m; i++) {</span>
-<span class="fc bfc" id="L736" title="All 4 branches covered.">                
    if (evictionIterator == null || !evictionIterator.hasNext()) {</span>
-<span class="fc" id="L737">                        evictionIterator = new 
EvictionIterator(idleObjects);</span>
+<span class="fc bfc" id="L754" title="All 2 branches covered.">                
for (int i = 0, m = getNumTests(); i &lt; m; i++) {</span>
+<span class="fc bfc" id="L755" title="All 4 branches covered.">                
    if (evictionIterator == null || !evictionIterator.hasNext()) {</span>
+<span class="fc" id="L756">                        evictionIterator = new 
EvictionIterator(idleObjects);</span>
                     }
-<span class="fc bfc" id="L739" title="All 2 branches covered.">                
    if (!evictionIterator.hasNext()) {</span>
+<span class="fc bfc" id="L758" title="All 2 branches covered.">                
    if (!evictionIterator.hasNext()) {</span>
                         // Pool exhausted, nothing to do here
-<span class="fc" id="L741">                        return;</span>
+<span class="fc" id="L760">                        return;</span>
                     }
 
                     try {
-<span class="fc" id="L745">                        underTest = 
evictionIterator.next();</span>
-<span class="nc" id="L746">                    } catch (final 
NoSuchElementException nsee) {</span>
+<span class="fc" id="L764">                        underTest = 
evictionIterator.next();</span>
+<span class="nc" id="L765">                    } catch (final 
NoSuchElementException nsee) {</span>
                         // Object was borrowed in another thread
                         // Don't count this as an eviction test so reduce i;
-<span class="nc" id="L749">                        i--;</span>
-<span class="nc" id="L750">                        evictionIterator = 
null;</span>
-<span class="nc" id="L751">                        continue;</span>
-<span class="fc" id="L752">                    }</span>
+<span class="nc" id="L768">                        i--;</span>
+<span class="nc" id="L769">                        evictionIterator = 
null;</span>
+<span class="nc" id="L770">                        continue;</span>
+<span class="fc" id="L771">                    }</span>
 
-<span class="fc bfc" id="L754" title="All 2 branches covered.">                
    if (!underTest.startEvictionTest()) {</span>
+<span class="fc bfc" id="L773" title="All 2 branches covered.">                
    if (!underTest.startEvictionTest()) {</span>
                         // Object was borrowed in another thread
                         // Don't count this as an eviction test so reduce i;
-<span class="fc" id="L757">                        i--;</span>
-<span class="fc" id="L758">                        continue;</span>
+<span class="fc" id="L776">                        i--;</span>
+<span class="fc" id="L777">                        continue;</span>
                     }
 
                     // User provided eviction policy could throw all sorts of
@@ -763,57 +782,57 @@ public class GenericObjectPool&lt;T&gt;
                     // killing the eviction thread.
                     boolean evict;
                     try {
-<span class="fc" id="L766">                        evict = 
evictionPolicy.evict(evictionConfig, underTest,</span>
-<span class="fc" id="L767">                                
idleObjects.size());</span>
-<span class="nc" id="L768">                    } catch (final Throwable t) 
{</span>
+<span class="fc" id="L785">                        evict = 
evictionPolicy.evict(evictionConfig, underTest,</span>
+<span class="fc" id="L786">                                
idleObjects.size());</span>
+<span class="nc" id="L787">                    } catch (final Throwable t) 
{</span>
                         // Slightly convoluted as SwallowedExceptionListener
                         // uses Exception rather than Throwable
-<span class="nc" id="L771">                        
PoolUtils.checkRethrow(t);</span>
-<span class="nc" id="L772">                        swallowException(new 
Exception(t));</span>
+<span class="nc" id="L790">                        
PoolUtils.checkRethrow(t);</span>
+<span class="nc" id="L791">                        swallowException(new 
Exception(t));</span>
                         // Don't evict on error conditions
-<span class="nc" id="L774">                        evict = false;</span>
-<span class="fc" id="L775">                    }</span>
+<span class="nc" id="L793">                        evict = false;</span>
+<span class="fc" id="L794">                    }</span>
 
-<span class="fc bfc" id="L777" title="All 2 branches covered.">                
    if (evict) {</span>
-<span class="fc" id="L778">                        destroy(underTest);</span>
-<span class="fc" id="L779">                        
destroyedByEvictorCount.incrementAndGet();</span>
+<span class="fc bfc" id="L796" title="All 2 branches covered.">                
    if (evict) {</span>
+<span class="fc" id="L797">                        destroy(underTest, 
DestroyMode.NORMAL);</span>
+<span class="fc" id="L798">                        
destroyedByEvictorCount.incrementAndGet();</span>
                     } else {
-<span class="fc bfc" id="L781" title="All 2 branches covered.">                
        if (testWhileIdle) {</span>
-<span class="fc" id="L782">                            boolean active = 
false;</span>
+<span class="fc bfc" id="L800" title="All 2 branches covered.">                
        if (testWhileIdle) {</span>
+<span class="fc" id="L801">                            boolean active = 
false;</span>
                             try {
-<span class="fc" id="L784">                                
factory.activateObject(underTest);</span>
-<span class="fc" id="L785">                                active = 
true;</span>
-<span class="fc" id="L786">                            } catch (final 
Exception e) {</span>
-<span class="fc" id="L787">                                
destroy(underTest);</span>
-<span class="fc" id="L788">                                
destroyedByEvictorCount.incrementAndGet();</span>
-<span class="fc" id="L789">                            }</span>
-<span class="fc bfc" id="L790" title="All 2 branches covered.">                
            if (active) {</span>
-<span class="fc bfc" id="L791" title="All 2 branches covered.">                
                if (!factory.validateObject(underTest)) {</span>
-<span class="fc" id="L792">                                    
destroy(underTest);</span>
-<span class="fc" id="L793">                                    
destroyedByEvictorCount.incrementAndGet();</span>
+<span class="fc" id="L803">                                
factory.activateObject(underTest);</span>
+<span class="fc" id="L804">                                active = 
true;</span>
+<span class="fc" id="L805">                            } catch (final 
Exception e) {</span>
+<span class="fc" id="L806">                                destroy(underTest, 
DestroyMode.NORMAL);</span>
+<span class="fc" id="L807">                                
destroyedByEvictorCount.incrementAndGet();</span>
+<span class="fc" id="L808">                            }</span>
+<span class="fc bfc" id="L809" title="All 2 branches covered.">                
            if (active) {</span>
+<span class="fc bfc" id="L810" title="All 2 branches covered.">                
                if (!factory.validateObject(underTest)) {</span>
+<span class="fc" id="L811">                                    
destroy(underTest, DestroyMode.NORMAL);</span>
+<span class="fc" id="L812">                                    
destroyedByEvictorCount.incrementAndGet();</span>
                                 } else {
                                     try {
-<span class="fc" id="L796">                                        
factory.passivateObject(underTest);</span>
-<span class="nc" id="L797">                                    } catch (final 
Exception e) {</span>
-<span class="nc" id="L798">                                        
destroy(underTest);</span>
-<span class="nc" id="L799">                                        
destroyedByEvictorCount.incrementAndGet();</span>
-<span class="fc" id="L800">                                    }</span>
+<span class="fc" id="L815">                                        
factory.passivateObject(underTest);</span>
+<span class="nc" id="L816">                                    } catch (final 
Exception e) {</span>
+<span class="nc" id="L817">                                        
destroy(underTest, DestroyMode.NORMAL);</span>
+<span class="nc" id="L818">                                        
destroyedByEvictorCount.incrementAndGet();</span>
+<span class="fc" id="L819">                                    }</span>
                                 }
                             }
                         }
-<span class="fc bfc" id="L804" title="All 2 branches covered.">                
        if (!underTest.endEvictionTest(idleObjects)) {</span>
+<span class="fc bfc" id="L823" title="All 2 branches covered.">                
        if (!underTest.endEvictionTest(idleObjects)) {</span>
                             // TODO - May need to add code here once additional
                             // states are used
                         }
                     }
                 }
-<span class="fc" id="L810">            }</span>
+<span class="fc" id="L829">            }</span>
         }
-<span class="fc" id="L812">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
-<span class="pc bpc" id="L813" title="1 of 4 branches missed.">        if (ac 
!= null &amp;&amp; ac.getRemoveAbandonedOnMaintenance()) {</span>
-<span class="fc" id="L814">            removeAbandoned(ac);</span>
+<span class="fc" id="L831">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
+<span class="pc bpc" id="L832" title="1 of 4 branches missed.">        if (ac 
!= null &amp;&amp; ac.getRemoveAbandonedOnMaintenance()) {</span>
+<span class="fc" id="L833">            removeAbandoned(ac);</span>
         }
-<span class="fc" id="L816">    }</span>
+<span class="fc" id="L835">    }</span>
 
     /**
      * Tries to ensure that {@link #getMinIdle()} idle instances are available
@@ -823,11 +842,11 @@ public class GenericObjectPool&lt;T&gt;
      * @since 2.4
      */
     public void preparePool() throws Exception {
-<span class="nc bnc" id="L826" title="All 2 branches missed.">        if 
(getMinIdle() &lt; 1) {</span>
-<span class="nc" id="L827">            return;</span>
+<span class="nc bnc" id="L845" title="All 2 branches missed.">        if 
(getMinIdle() &lt; 1) {</span>
+<span class="nc" id="L846">            return;</span>
         }
-<span class="nc" id="L829">        ensureMinIdle();</span>
-<span class="nc" id="L830">    }</span>
+<span class="nc" id="L848">        ensureMinIdle();</span>
+<span class="nc" id="L849">    }</span>
 
     /**
      * Attempts to create a new wrapped pooled object.
@@ -841,111 +860,112 @@ public class GenericObjectPool&lt;T&gt;
      * @throws Exception if the object factory's {@code makeObject} fails
      */
     private PooledObject&lt;T&gt; create() throws Exception {
-<span class="fc" id="L844">        int localMaxTotal = getMaxTotal();</span>
+<span class="fc" id="L863">        int localMaxTotal = getMaxTotal();</span>
         // This simplifies the code later in this method
-<span class="fc bfc" id="L846" title="All 2 branches covered.">        if 
(localMaxTotal &lt; 0) {</span>
-<span class="fc" id="L847">            localMaxTotal = 
Integer.MAX_VALUE;</span>
+<span class="fc bfc" id="L865" title="All 2 branches covered.">        if 
(localMaxTotal &lt; 0) {</span>
+<span class="fc" id="L866">            localMaxTotal = 
Integer.MAX_VALUE;</span>
         }
 
-<span class="fc" id="L850">        final long localStartTimeMillis = 
System.currentTimeMillis();</span>
-<span class="fc" id="L851">        final long localMaxWaitTimeMillis = 
Math.max(getMaxWaitMillis(), 0);</span>
+<span class="fc" id="L869">        final long localStartTimeMillis = 
System.currentTimeMillis();</span>
+<span class="fc" id="L870">        final long localMaxWaitTimeMillis = 
Math.max(getMaxWaitMillis(), 0);</span>
 
         // Flag that indicates if create should:
         // - TRUE:  call the factory to create an object
         // - FALSE: return null
         // - null:  loop and re-test the condition that determines whether to
         //          call the factory
-<span class="fc" id="L858">        Boolean create = null;</span>
-<span class="fc bfc" id="L859" title="All 2 branches covered.">        while 
(create == null) {</span>
-<span class="fc" id="L860">            synchronized (makeObjectCountLock) 
{</span>
-<span class="fc" id="L861">                final long newCreateCount = 
createCount.incrementAndGet();</span>
-<span class="fc bfc" id="L862" title="All 2 branches covered.">                
if (newCreateCount &gt; localMaxTotal) {</span>
+<span class="fc" id="L877">        Boolean create = null;</span>
+<span class="fc bfc" id="L878" title="All 2 branches covered.">        while 
(create == null) {</span>
+<span class="fc" id="L879">            synchronized (makeObjectCountLock) 
{</span>
+<span class="fc" id="L880">                final long newCreateCount = 
createCount.incrementAndGet();</span>
+<span class="fc bfc" id="L881" title="All 2 branches covered.">                
if (newCreateCount &gt; localMaxTotal) {</span>
                     // The pool is currently at capacity or in the process of
                     // making enough new objects to take it to capacity.
-<span class="fc" id="L865">                    
createCount.decrementAndGet();</span>
-<span class="fc bfc" id="L866" title="All 2 branches covered.">                
    if (makeObjectCount == 0) {</span>
+<span class="fc" id="L884">                    
createCount.decrementAndGet();</span>
+<span class="fc bfc" id="L885" title="All 2 branches covered.">                
    if (makeObjectCount == 0) {</span>
                         // There are no makeObject() calls in progress so the
                         // pool is at capacity. Do not attempt to create a new
                         // object. Return and wait for an object to be returned
-<span class="fc" id="L870">                        create = 
Boolean.FALSE;</span>
+<span class="fc" id="L889">                        create = 
Boolean.FALSE;</span>
                     } else {
                         // There are makeObject() calls in progress that might
                         // bring the pool to capacity. Those calls might also
                         // fail so wait until they complete and then re-test if
                         // the pool is at capacity or not.
-<span class="fc" id="L876">                        
makeObjectCountLock.wait(localMaxWaitTimeMillis);</span>
+<span class="fc" id="L895">                        
makeObjectCountLock.wait(localMaxWaitTimeMillis);</span>
                     }
                 } else {
                     // The pool is not at capacity. Create a new object.
-<span class="fc" id="L880">                    makeObjectCount++;</span>
-<span class="fc" id="L881">                    create = Boolean.TRUE;</span>
+<span class="fc" id="L899">                    makeObjectCount++;</span>
+<span class="fc" id="L900">                    create = Boolean.TRUE;</span>
                 }
-<span class="fc" id="L883">            }</span>
+<span class="fc" id="L902">            }</span>
 
             // Do not block more if maxWaitTimeMillis is set.
-<span class="fc bfc" id="L886" title="All 4 branches covered.">            if 
(create == null &amp;&amp;</span>
+<span class="fc bfc" id="L905" title="All 4 branches covered.">            if 
(create == null &amp;&amp;</span>
                 (localMaxWaitTimeMillis &gt; 0 &amp;&amp;
-<span class="pc bpc" id="L888" title="1 of 2 branches missed.">                
 System.currentTimeMillis() - localStartTimeMillis &gt;= 
localMaxWaitTimeMillis)) {</span>
-<span class="fc" id="L889">                create = Boolean.FALSE;</span>
+<span class="pc bpc" id="L907" title="1 of 2 branches missed.">                
 System.currentTimeMillis() - localStartTimeMillis &gt;= 
localMaxWaitTimeMillis)) {</span>
+<span class="fc" id="L908">                create = Boolean.FALSE;</span>
             }
         }
 
-<span class="fc bfc" id="L893" title="All 2 branches covered.">        if 
(!create.booleanValue()) {</span>
-<span class="fc" id="L894">            return null;</span>
+<span class="fc bfc" id="L912" title="All 2 branches covered.">        if 
(!create.booleanValue()) {</span>
+<span class="fc" id="L913">            return null;</span>
         }
 
         final PooledObject&lt;T&gt; p;
         try {
-<span class="fc" id="L899">            p = factory.makeObject();</span>
-<span class="fc bfc" id="L900" title="All 4 branches covered.">            if 
(getTestOnCreate() &amp;&amp; !factory.validateObject(p)) {</span>
-<span class="fc" id="L901">                
createCount.decrementAndGet();</span>
-<span class="fc" id="L902">                return null;</span>
+<span class="fc" id="L918">            p = factory.makeObject();</span>
+<span class="fc bfc" id="L919" title="All 4 branches covered.">            if 
(getTestOnCreate() &amp;&amp; !factory.validateObject(p)) {</span>
+<span class="fc" id="L920">                
createCount.decrementAndGet();</span>
+<span class="fc" id="L921">                return null;</span>
             }
-<span class="fc" id="L904">        } catch (final Throwable e) {</span>
-<span class="fc" id="L905">            createCount.decrementAndGet();</span>
-<span class="fc" id="L906">            throw e;</span>
+<span class="fc" id="L923">        } catch (final Throwable e) {</span>
+<span class="fc" id="L924">            createCount.decrementAndGet();</span>
+<span class="fc" id="L925">            throw e;</span>
         } finally {
-<span class="fc" id="L908">            synchronized (makeObjectCountLock) 
{</span>
-<span class="fc" id="L909">                makeObjectCount--;</span>
-<span class="fc" id="L910">                
makeObjectCountLock.notifyAll();</span>
-<span class="fc" id="L911">            }</span>
+<span class="fc" id="L927">            synchronized (makeObjectCountLock) 
{</span>
+<span class="fc" id="L928">                makeObjectCount--;</span>
+<span class="fc" id="L929">                
makeObjectCountLock.notifyAll();</span>
+<span class="fc" id="L930">            }</span>
         }
 
-<span class="fc" id="L914">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
-<span class="fc bfc" id="L915" title="All 4 branches covered.">        if (ac 
!= null &amp;&amp; ac.getLogAbandoned()) {</span>
-<span class="fc" id="L916">            p.setLogAbandoned(true);</span>
-<span class="fc" id="L917">            
p.setRequireFullStackTrace(ac.getRequireFullStackTrace());</span>
+<span class="fc" id="L933">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
+<span class="fc bfc" id="L934" title="All 4 branches covered.">        if (ac 
!= null &amp;&amp; ac.getLogAbandoned()) {</span>
+<span class="fc" id="L935">            p.setLogAbandoned(true);</span>
+<span class="fc" id="L936">            
p.setRequireFullStackTrace(ac.getRequireFullStackTrace());</span>
         }
 
-<span class="fc" id="L920">        createdCount.incrementAndGet();</span>
-<span class="fc" id="L921">        allObjects.put(new 
IdentityWrapper&lt;&gt;(p.getObject()), p);</span>
-<span class="fc" id="L922">        return p;</span>
+<span class="fc" id="L939">        createdCount.incrementAndGet();</span>
+<span class="fc" id="L940">        allObjects.put(new 
IdentityWrapper&lt;&gt;(p.getObject()), p);</span>
+<span class="fc" id="L941">        return p;</span>
     }
 
     /**
      * Destroys a wrapped pooled object.
      *
      * @param toDestroy The wrapped pooled object to destroy
+     * @param mode DestroyMode context provided to the factory
      *
      * @throws Exception If the factory fails to destroy the pooled object
      *                   cleanly
      */
-    private void destroy(final PooledObject&lt;T&gt; toDestroy) throws 
Exception {
-<span class="fc" id="L934">        toDestroy.invalidate();</span>
-<span class="fc" id="L935">        idleObjects.remove(toDestroy);</span>
-<span class="fc" id="L936">        allObjects.remove(new 
IdentityWrapper&lt;&gt;(toDestroy.getObject()));</span>
+    private void destroy(final PooledObject&lt;T&gt; toDestroy, final 
DestroyMode mode) throws Exception {
+<span class="fc" id="L954">        toDestroy.invalidate();</span>
+<span class="fc" id="L955">        idleObjects.remove(toDestroy);</span>
+<span class="fc" id="L956">        allObjects.remove(new 
IdentityWrapper&lt;&gt;(toDestroy.getObject()));</span>
         try {
-<span class="fc" id="L938">            factory.destroyObject(toDestroy);</span>
+<span class="fc" id="L958">            factory.destroyObject(toDestroy, 
mode);</span>
         } finally {
-<span class="fc" id="L940">            destroyedCount.incrementAndGet();</span>
-<span class="fc" id="L941">            createCount.decrementAndGet();</span>
+<span class="fc" id="L960">            destroyedCount.incrementAndGet();</span>
+<span class="fc" id="L961">            createCount.decrementAndGet();</span>
         }
-<span class="fc" id="L943">    }</span>
+<span class="fc" id="L963">    }</span>
 
     @Override
     void ensureMinIdle() throws Exception {
-<span class="fc" id="L947">        ensureIdle(getMinIdle(), true);</span>
-<span class="fc" id="L948">    }</span>
+<span class="fc" id="L967">        ensureIdle(getMinIdle(), true);</span>
+<span class="fc" id="L968">    }</span>
 
     /**
      * Tries to ensure that {@code idleCount} idle instances exist in the pool.
@@ -961,30 +981,30 @@ public class GenericObjectPool&lt;T&gt;
      * @throws Exception if the factory's makeObject throws
      */
     private void ensureIdle(final int idleCount, final boolean always) throws 
Exception {
-<span class="fc bfc" id="L964" title="All 8 branches covered.">        if 
(idleCount &lt; 1 || isClosed() || (!always &amp;&amp; 
!idleObjects.hasTakeWaiters())) {</span>
-<span class="fc" id="L965">            return;</span>
+<span class="fc bfc" id="L984" title="All 8 branches covered.">        if 
(idleCount &lt; 1 || isClosed() || (!always &amp;&amp; 
!idleObjects.hasTakeWaiters())) {</span>
+<span class="fc" id="L985">            return;</span>
         }
 
-<span class="fc bfc" id="L968" title="All 2 branches covered.">        while 
(idleObjects.size() &lt; idleCount) {</span>
-<span class="fc" id="L969">            final PooledObject&lt;T&gt; p = 
create();</span>
-<span class="fc bfc" id="L970" title="All 2 branches covered.">            if 
(p == null) {</span>
+<span class="fc bfc" id="L988" title="All 2 branches covered.">        while 
(idleObjects.size() &lt; idleCount) {</span>
+<span class="fc" id="L989">            final PooledObject&lt;T&gt; p = 
create();</span>
+<span class="fc bfc" id="L990" title="All 2 branches covered.">            if 
(p == null) {</span>
                 // Can't create objects, no reason to think another call to
                 // create will work. Give up.
-<span class="fc" id="L973">                break;</span>
+<span class="fc" id="L993">                break;</span>
             }
-<span class="pc bpc" id="L975" title="1 of 2 branches missed.">            if 
(getLifo()) {</span>
-<span class="fc" id="L976">                idleObjects.addFirst(p);</span>
+<span class="pc bpc" id="L995" title="1 of 2 branches missed.">            if 
(getLifo()) {</span>
+<span class="fc" id="L996">                idleObjects.addFirst(p);</span>
             } else {
-<span class="nc" id="L978">                idleObjects.addLast(p);</span>
+<span class="nc" id="L998">                idleObjects.addLast(p);</span>
             }
-<span class="fc" id="L980">        }</span>
-<span class="pc bpc" id="L981" title="1 of 2 branches missed.">        if 
(isClosed()) {</span>
+<span class="fc" id="L1000">        }</span>
+<span class="pc bpc" id="L1001" title="1 of 2 branches missed.">        if 
(isClosed()) {</span>
             // Pool closed while object was being added to idle objects.
             // Make sure the returned object is destroyed rather than left
             // in the idle object pool (which would effectively be a leak)
-<span class="nc" id="L985">            clear();</span>
+<span class="nc" id="L1005">            clear();</span>
         }
-<span class="fc" id="L987">    }</span>
+<span class="fc" id="L1007">    }</span>
 
     /**
      * Creates an object, and place it into the pool. addObject() is useful for
@@ -995,14 +1015,14 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public void addObject() throws Exception {
-<span class="fc" id="L998">        assertOpen();</span>
-<span class="pc bpc" id="L999" title="1 of 2 branches missed.">        if 
(factory == null) {</span>
-<span class="nc" id="L1000">            throw new IllegalStateException(</span>
+<span class="fc" id="L1018">        assertOpen();</span>
+<span class="pc bpc" id="L1019" title="1 of 2 branches missed.">        if 
(factory == null) {</span>
+<span class="nc" id="L1020">            throw new IllegalStateException(</span>
                     &quot;Cannot add objects without a factory.&quot;);
         }
-<span class="fc" id="L1003">        final PooledObject&lt;T&gt; p = 
create();</span>
-<span class="fc" id="L1004">        addIdleObject(p);</span>
-<span class="fc" id="L1005">    }</span>
+<span class="fc" id="L1023">        final PooledObject&lt;T&gt; p = 
create();</span>
+<span class="fc" id="L1024">        addIdleObject(p);</span>
+<span class="fc" id="L1025">    }</span>
 
     /**
      * Adds the provided wrapped pooled object to the set of idle objects for
@@ -1014,15 +1034,15 @@ public class GenericObjectPool&lt;T&gt;
      * @throws Exception If the factory fails to passivate the object
      */
     private void addIdleObject(final PooledObject&lt;T&gt; p) throws Exception 
{
-<span class="fc bfc" id="L1017" title="All 2 branches covered.">        if (p 
!= null) {</span>
-<span class="fc" id="L1018">            factory.passivateObject(p);</span>
-<span class="fc bfc" id="L1019" title="All 2 branches covered.">            if 
(getLifo()) {</span>
-<span class="fc" id="L1020">                idleObjects.addFirst(p);</span>
+<span class="fc bfc" id="L1037" title="All 2 branches covered.">        if (p 
!= null) {</span>
+<span class="fc" id="L1038">            factory.passivateObject(p);</span>
+<span class="fc bfc" id="L1039" title="All 2 branches covered.">            if 
(getLifo()) {</span>
+<span class="fc" id="L1040">                idleObjects.addFirst(p);</span>
             } else {
-<span class="fc" id="L1022">                idleObjects.addLast(p);</span>
+<span class="fc" id="L1042">                idleObjects.addLast(p);</span>
             }
         }
-<span class="fc" id="L1025">    }</span>
+<span class="fc" id="L1045">    }</span>
 
     /**
      * Calculates the number of objects to test in a run of the idle object
@@ -1031,69 +1051,70 @@ public class GenericObjectPool&lt;T&gt;
      * @return The number of objects to test for validity
      */
     private int getNumTests() {
-<span class="fc" id="L1034">        final int numTestsPerEvictionRun = 
getNumTestsPerEvictionRun();</span>
-<span class="fc bfc" id="L1035" title="All 2 branches covered.">        if 
(numTestsPerEvictionRun &gt;= 0) {</span>
-<span class="fc" id="L1036">            return 
Math.min(numTestsPerEvictionRun, idleObjects.size());</span>
+<span class="fc" id="L1054">        final int numTestsPerEvictionRun = 
getNumTestsPerEvictionRun();</span>
+<span class="fc bfc" id="L1055" title="All 2 branches covered.">        if 
(numTestsPerEvictionRun &gt;= 0) {</span>
+<span class="fc" id="L1056">            return 
Math.min(numTestsPerEvictionRun, idleObjects.size());</span>
         }
-<span class="fc" id="L1038">        return (int) (Math.ceil(idleObjects.size() 
/</span>
-<span class="fc" id="L1039">                Math.abs((double) 
numTestsPerEvictionRun)));</span>
+<span class="fc" id="L1058">        return (int) (Math.ceil(idleObjects.size() 
/</span>
+<span class="fc" id="L1059">                Math.abs((double) 
numTestsPerEvictionRun)));</span>
     }
 
     /**
      * Recovers abandoned objects which have been checked out but
      * not used since longer than the removeAbandonedTimeout.
      *
-     * @param ac The configuration to use to identify abandoned objects
+     * @param abandonedConfig The configuration to use to identify abandoned 
objects
      */
-    private void removeAbandoned(final AbandonedConfig ac) {
+    @SuppressWarnings(&quot;resource&quot;) // PrintWriter is managed elsewhere
+    private void removeAbandoned(final AbandonedConfig abandonedConfig) {
         // Generate a list of abandoned objects to remove
-<span class="fc" id="L1050">        final long now = 
System.currentTimeMillis();</span>
-<span class="fc" id="L1051">        final long timeout =</span>
-<span class="fc" id="L1052">                now - 
(ac.getRemoveAbandonedTimeout() * 1000L);</span>
-<span class="fc" id="L1053">        final 
ArrayList&lt;PooledObject&lt;T&gt;&gt; remove = new ArrayList&lt;&gt;();</span>
-<span class="fc" id="L1054">        final 
Iterator&lt;PooledObject&lt;T&gt;&gt; it = 
allObjects.values().iterator();</span>
-<span class="fc bfc" id="L1055" title="All 2 branches covered.">        while 
(it.hasNext()) {</span>
-<span class="fc" id="L1056">            final PooledObject&lt;T&gt; 
pooledObject = it.next();</span>
-<span class="fc" id="L1057">            synchronized (pooledObject) {</span>
-<span class="fc bfc" id="L1058" title="All 2 branches covered.">               
 if (pooledObject.getState() == PooledObjectState.ALLOCATED &amp;&amp;</span>
-<span class="fc bfc" id="L1059" title="All 2 branches covered.">               
         pooledObject.getLastUsedTime() &lt;= timeout) {</span>
-<span class="fc" id="L1060">                    
pooledObject.markAbandoned();</span>
-<span class="fc" id="L1061">                    
remove.add(pooledObject);</span>
+<span class="fc" id="L1071">        final long now = 
System.currentTimeMillis();</span>
+<span class="fc" id="L1072">        final long timeout =</span>
+<span class="fc" id="L1073">                now - 
(abandonedConfig.getRemoveAbandonedTimeout() * 1000L);</span>
+<span class="fc" id="L1074">        final 
ArrayList&lt;PooledObject&lt;T&gt;&gt; remove = new ArrayList&lt;&gt;();</span>
+<span class="fc" id="L1075">        final 
Iterator&lt;PooledObject&lt;T&gt;&gt; it = 
allObjects.values().iterator();</span>
+<span class="fc bfc" id="L1076" title="All 2 branches covered.">        while 
(it.hasNext()) {</span>
+<span class="fc" id="L1077">            final PooledObject&lt;T&gt; 
pooledObject = it.next();</span>
+<span class="fc" id="L1078">            synchronized (pooledObject) {</span>
+<span class="fc bfc" id="L1079" title="All 2 branches covered.">               
 if (pooledObject.getState() == PooledObjectState.ALLOCATED &amp;&amp;</span>
+<span class="fc bfc" id="L1080" title="All 2 branches covered.">               
         pooledObject.getLastUsedTime() &lt;= timeout) {</span>
+<span class="fc" id="L1081">                    
pooledObject.markAbandoned();</span>
+<span class="fc" id="L1082">                    
remove.add(pooledObject);</span>
                 }
-<span class="fc" id="L1063">            }</span>
-<span class="fc" id="L1064">        }</span>
+<span class="fc" id="L1084">            }</span>
+<span class="fc" id="L1085">        }</span>
 
         // Now remove the abandoned objects
-<span class="fc" id="L1067">        final 
Iterator&lt;PooledObject&lt;T&gt;&gt; itr = remove.iterator();</span>
-<span class="fc bfc" id="L1068" title="All 2 branches covered.">        while 
(itr.hasNext()) {</span>
-<span class="fc" id="L1069">            final PooledObject&lt;T&gt; 
pooledObject = itr.next();</span>
-<span class="fc bfc" id="L1070" title="All 2 branches covered.">            if 
(ac.getLogAbandoned()) {</span>
-<span class="fc" id="L1071">                
pooledObject.printStackTrace(ac.getLogWriter());</span>
+<span class="fc" id="L1088">        final 
Iterator&lt;PooledObject&lt;T&gt;&gt; itr = remove.iterator();</span>
+<span class="fc bfc" id="L1089" title="All 2 branches covered.">        while 
(itr.hasNext()) {</span>
+<span class="fc" id="L1090">            final PooledObject&lt;T&gt; 
pooledObject = itr.next();</span>
+<span class="fc bfc" id="L1091" title="All 2 branches covered.">            if 
(abandonedConfig.getLogAbandoned()) {</span>
+<span class="fc" id="L1092">                
pooledObject.printStackTrace(abandonedConfig.getLogWriter());</span>
             }
             try {
-<span class="fc" id="L1074">                
invalidateObject(pooledObject.getObject());</span>
-<span class="nc" id="L1075">            } catch (final Exception e) {</span>
-<span class="nc" id="L1076">                e.printStackTrace();</span>
-<span class="fc" id="L1077">            }</span>
-<span class="fc" id="L1078">        }</span>
-<span class="fc" id="L1079">    }</span>
+<span class="fc" id="L1095">                
invalidateObject(pooledObject.getObject(), DestroyMode.ABANDONED);</span>
+<span class="nc" id="L1096">            } catch (final Exception e) {</span>
+<span class="nc" id="L1097">                e.printStackTrace();</span>
+<span class="fc" id="L1098">            }</span>
+<span class="fc" id="L1099">        }</span>
+<span class="fc" id="L1100">    }</span>
 
 
     //--- Usage tracking support 
-----------------------------------------------
 
     @Override
     public void use(final T pooledObject) {
-<span class="fc" id="L1086">        final AbandonedConfig ac = 
this.abandonedConfig;</span>
-<span class="pc bpc" id="L1087" title="2 of 4 branches missed.">        if (ac 
!= null &amp;&amp; ac.getUseUsageTracking()) {</span>
-<span class="fc" id="L1088">            final PooledObject&lt;T&gt; wrapper = 
allObjects.get(new IdentityWrapper&lt;&gt;(pooledObject));</span>
-<span class="fc" id="L1089">            wrapper.use();</span>
+<span class="fc" id="L1107">        final AbandonedConfig abandonedCfg = 
this.abandonedConfig;</span>
+<span class="pc bpc" id="L1108" title="2 of 4 branches missed.">        if 
(abandonedCfg != null &amp;&amp; abandonedCfg.getUseUsageTracking()) {</span>
+<span class="fc" id="L1109">            final PooledObject&lt;T&gt; wrapper = 
allObjects.get(new IdentityWrapper&lt;&gt;(pooledObject));</span>
+<span class="fc" id="L1110">            wrapper.use();</span>
         }
-<span class="fc" id="L1091">    }</span>
+<span class="fc" id="L1112">    }</span>
 
 
     //--- JMX support 
----------------------------------------------------------
 
-<span class="fc" id="L1096">    private volatile String factoryType = 
null;</span>
+<span class="fc" id="L1117">    private volatile String factoryType = 
null;</span>
 
     /**
      * Returns an estimate of the number of threads currently blocked waiting 
for
@@ -1105,10 +1126,10 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public int getNumWaiters() {
-<span class="nc bnc" id="L1108" title="All 2 branches missed.">        if 
(getBlockWhenExhausted()) {</span>
-<span class="nc" id="L1109">            return 
idleObjects.getTakeQueueLength();</span>
+<span class="nc bnc" id="L1129" title="All 2 branches missed.">        if 
(getBlockWhenExhausted()) {</span>
+<span class="nc" id="L1130">            return 
idleObjects.getTakeQueueLength();</span>
         }
-<span class="nc" id="L1111">        return 0;</span>
+<span class="nc" id="L1132">        return 0;</span>
     }
 
     /**
@@ -1120,17 +1141,17 @@ public class GenericObjectPool&lt;T&gt;
     @Override
     public String getFactoryType() {
         // Not thread safe. Accept that there may be multiple evaluations.
-<span class="pc bpc" id="L1123" title="1 of 2 branches missed.">        if 
(factoryType == null) {</span>
-<span class="fc" id="L1124">            final StringBuilder result = new 
StringBuilder();</span>
-<span class="fc" id="L1125">            
result.append(factory.getClass().getName());</span>
-<span class="fc" id="L1126">            result.append('&lt;');</span>
-<span class="fc" id="L1127">            final Class&lt;?&gt; pooledObjectType 
=</span>
-<span class="fc" id="L1128">                    
PoolImplUtils.getFactoryType(factory.getClass());</span>
-<span class="fc" id="L1129">            
result.append(pooledObjectType.getName());</span>
-<span class="fc" id="L1130">            result.append('&gt;');</span>
-<span class="fc" id="L1131">            factoryType = result.toString();</span>
+<span class="pc bpc" id="L1144" title="1 of 2 branches missed.">        if 
(factoryType == null) {</span>
+<span class="fc" id="L1145">            final StringBuilder result = new 
StringBuilder();</span>
+<span class="fc" id="L1146">            
result.append(factory.getClass().getName());</span>
+<span class="fc" id="L1147">            result.append('&lt;');</span>
+<span class="fc" id="L1148">            final Class&lt;?&gt; pooledObjectType 
=</span>
+<span class="fc" id="L1149">                    
PoolImplUtils.getFactoryType(factory.getClass());</span>
+<span class="fc" id="L1150">            
result.append(pooledObjectType.getName());</span>
+<span class="fc" id="L1151">            result.append('&gt;');</span>
+<span class="fc" id="L1152">            factoryType = result.toString();</span>
         }
-<span class="fc" id="L1133">        return factoryType;</span>
+<span class="fc" id="L1154">        return factoryType;</span>
     }
 
     /**
@@ -1147,18 +1168,18 @@ public class GenericObjectPool&lt;T&gt;
      */
     @Override
     public Set&lt;DefaultPooledObjectInfo&gt; listAllObjects() {
-<span class="fc" id="L1150">        final Set&lt;DefaultPooledObjectInfo&gt; 
result =</span>
-<span class="fc" id="L1151">                new 
HashSet&lt;&gt;(allObjects.size());</span>
-<span class="fc bfc" id="L1152" title="All 2 branches covered.">        for 
(final PooledObject&lt;T&gt; p : allObjects.values()) {</span>
-<span class="fc" id="L1153">            result.add(new 
DefaultPooledObjectInfo(p));</span>
-<span class="fc" id="L1154">        }</span>
-<span class="fc" id="L1155">        return result;</span>
+<span class="fc" id="L1171">        final Set&lt;DefaultPooledObjectInfo&gt; 
result =</span>
+<span class="fc" id="L1172">                new 
HashSet&lt;&gt;(allObjects.size());</span>
+<span class="fc bfc" id="L1173" title="All 2 branches covered.">        for 
(final PooledObject&lt;T&gt; p : allObjects.values()) {</span>
+<span class="fc" id="L1174">            result.add(new 
DefaultPooledObjectInfo(p));</span>
+<span class="fc" id="L1175">        }</span>
+<span class="fc" id="L1176">        return result;</span>
     }
 
     // --- configuration attributes 
--------------------------------------------
 
-<span class="fc" id="L1160">    private volatile int maxIdle = 
GenericObjectPoolConfig.DEFAULT_MAX_IDLE;</span>
-<span class="fc" id="L1161">    private volatile int minIdle = 
GenericObjectPoolConfig.DEFAULT_MIN_IDLE;</span>
+<span class="fc" id="L1181">    private volatile int maxIdle = 
GenericObjectPoolConfig.DEFAULT_MAX_IDLE;</span>
+<span class="fc" id="L1182">    private volatile int minIdle = 
GenericObjectPoolConfig.DEFAULT_MIN_IDLE;</span>
     private final PooledObjectFactory&lt;T&gt; factory;
 
 
@@ -1171,7 +1192,7 @@ public class GenericObjectPool&lt;T&gt;
      * #_maxActive}. Map keys are pooled objects, values are the PooledObject
      * wrappers used internally by the pool.
      */
-<span class="fc" id="L1174">    private final Map&lt;IdentityWrapper&lt;T&gt;, 
PooledObject&lt;T&gt;&gt; allObjects =</span>
+<span class="fc" id="L1195">    private final Map&lt;IdentityWrapper&lt;T&gt;, 
PooledObject&lt;T&gt;&gt; allObjects =</span>
         new ConcurrentHashMap&lt;&gt;();
     /*
      * The combined count of the currently created objects and those in the
@@ -1180,9 +1201,9 @@ public class GenericObjectPool&lt;T&gt;
      * {@link #create()} will ensure that there are never more than
      * {@link #_maxActive} objects created at any one time.
      */
-<span class="fc" id="L1183">    private final AtomicLong createCount = new 
AtomicLong(0);</span>
-<span class="fc" id="L1184">    private long makeObjectCount = 0;</span>
-<span class="fc" id="L1185">    private final Object makeObjectCountLock = new 
Object();</span>
+<span class="fc" id="L1204">    private final AtomicLong createCount = new 
AtomicLong(0);</span>
+<span class="fc" id="L1205">    private long makeObjectCount = 0;</span>
+<span class="fc" id="L1206">    private final Object makeObjectCountLock = new 
Object();</span>
     private final LinkedBlockingDeque&lt;PooledObject&lt;T&gt;&gt; idleObjects;
 
     // JMX specific attributes
@@ -1190,28 +1211,28 @@ public class GenericObjectPool&lt;T&gt;
         &quot;org.apache.commons.pool2:type=GenericObjectPool,name=&quot;;
 
     // Additional configuration properties for abandoned object tracking
-<span class="fc" id="L1193">    private volatile AbandonedConfig 
abandonedConfig = null;</span>
+<span class="fc" id="L1214">    private volatile AbandonedConfig 
abandonedConfig = null;</span>
 
     @Override
     protected void toStringAppendFields(final StringBuilder builder) {
-<span class="fc" id="L1197">        super.toStringAppendFields(builder);</span>
-<span class="fc" id="L1198">        builder.append(&quot;, 
factoryType=&quot;);</span>
-<span class="fc" id="L1199">        builder.append(factoryType);</span>
-<span class="fc" id="L1200">        builder.append(&quot;, 
maxIdle=&quot;);</span>
-<span class="fc" id="L1201">        builder.append(maxIdle);</span>
-<span class="fc" id="L1202">        builder.append(&quot;, 
minIdle=&quot;);</span>
-<span class="fc" id="L1203">        builder.append(minIdle);</span>
-<span class="fc" id="L1204">        builder.append(&quot;, 
factory=&quot;);</span>
-<span class="fc" id="L1205">        builder.append(factory);</span>
-<span class="fc" id="L1206">        builder.append(&quot;, 
allObjects=&quot;);</span>
-<span class="fc" id="L1207">        builder.append(allObjects);</span>
-<span class="fc" id="L1208">        builder.append(&quot;, 
createCount=&quot;);</span>
-<span class="fc" id="L1209">        builder.append(createCount);</span>
-<span class="fc" id="L1210">        builder.append(&quot;, 
idleObjects=&quot;);</span>
-<span class="fc" id="L1211">        builder.append(idleObjects);</span>
-<span class="fc" id="L1212">        builder.append(&quot;, 
abandonedConfig=&quot;);</span>
-<span class="fc" id="L1213">        builder.append(abandonedConfig);</span>
-<span class="fc" id="L1214">    }</span>
+<span class="fc" id="L1218">        super.toStringAppendFields(builder);</span>
+<span class="fc" id="L1219">        builder.append(&quot;, 
factoryType=&quot;);</span>
+<span class="fc" id="L1220">        builder.append(factoryType);</span>
+<span class="fc" id="L1221">        builder.append(&quot;, 
maxIdle=&quot;);</span>
+<span class="fc" id="L1222">        builder.append(maxIdle);</span>
+<span class="fc" id="L1223">        builder.append(&quot;, 
minIdle=&quot;);</span>
+<span class="fc" id="L1224">        builder.append(minIdle);</span>
+<span class="fc" id="L1225">        builder.append(&quot;, 
factory=&quot;);</span>
+<span class="fc" id="L1226">        builder.append(factory);</span>
+<span class="fc" id="L1227">        builder.append(&quot;, 
allObjects=&quot;);</span>
+<span class="fc" id="L1228">        builder.append(allObjects);</span>
+<span class="fc" id="L1229">        builder.append(&quot;, 
createCount=&quot;);</span>
+<span class="fc" id="L1230">        builder.append(createCount);</span>
+<span class="fc" id="L1231">        builder.append(&quot;, 
idleObjects=&quot;);</span>
+<span class="fc" id="L1232">        builder.append(idleObjects);</span>
+<span class="fc" id="L1233">        builder.append(&quot;, 
abandonedConfig=&quot;);</span>
+<span class="fc" id="L1234">        builder.append(abandonedConfig);</span>
+<span class="fc" id="L1235">    }</span>
 
 }
 </pre><div class="footer"><span class="right">Created with <a 
href="http://www.jacoco.org/jacoco";>JaCoCo</a> 
0.8.5.201910111838</span></div></body></html>
\ No newline at end of file


Reply via email to