commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: Fwd: svn commit: r1767714 - in /commons/proper/pool/trunk/src: changes/changes.xml main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
Date Wed, 02 Nov 2016 18:29:15 GMT
On 02/11/2016 18:12, Gary Gregory wrote:
> Is it time to push out 2.4.3? There are couple of interesting fixes.

Getting close. I'd like to finish going through the open issues first.

Mark


> 
> Gary
> ---------- Forwarded message ----------
> From: <markt@apache.org>
> Date: Wed, Nov 2, 2016 at 8:53 AM
> Subject: svn commit: r1767714 - in /commons/proper/pool/trunk/src:
> changes/changes.xml
> main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
> test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
> To: commits@commons.apache.org
> 
> 
> Author: markt
> Date: Wed Nov  2 15:53:08 2016
> New Revision: 1767714
> 
> URL: http://svn.apache.org/viewvc?rev=1767714&view=rev
> Log:
> Check class used for evictionPolicyClassName implements EvictionPolicy
> 
> Modified:
>     commons/proper/pool/trunk/src/changes/changes.xml
>     commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/
> BaseGenericObjectPool.java
>     commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/
> TestGenericObjectPool.java
> 
> Modified: commons/proper/pool/trunk/src/changes/changes.xml
> URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/
> changes/changes.xml?rev=1767714&r1=1767713&r2=1767714&view=diff
> ============================================================
> ==================
> --- commons/proper/pool/trunk/src/changes/changes.xml (original)
> +++ commons/proper/pool/trunk/src/changes/changes.xml Wed Nov  2 15:53:08
> 2016
> @@ -67,6 +67,10 @@ The <action> type attribute can be add,u
>        maxTotal threads try to borrow objects with different keys at the
> same
>        time and the factory destroys objects on return.
>      </action>
> +    <action dev="markt" type="fix">
> +      Ensure that any class name used for evictionPolicyClassName
> represents a
> +      class that implements EvictionPolicy.
> +    </action>
>    </release>
>    <release version="2.4.2" date="2015-08-01" description=
>   "This is a patch release, including bug fixes only.">
> 
> Modified: commons/proper/pool/trunk/src/main/java/org/apache/commons/
> pool2/impl/BaseGenericObjectPool.java
> URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/
> main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java?
> rev=1767714&r1=1767713&r2=1767714&view=diff
> ============================================================
> ==================
> --- commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
> (original)
> +++ commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
> Wed Nov  2 15:53:08 2016
> @@ -613,6 +613,9 @@ public abstract class BaseGenericObjectP
>                  final
>                  EvictionPolicy<T> evicPolicy = (EvictionPolicy<T>) policy;
>                  this.evictionPolicy = evicPolicy;
> +            } else {
> +                throw new IllegalArgumentException("[" +
> evictionPolicyClassName +
> +                        "] does not implement EvictionPolicy");
>              }
>          } catch (final ClassNotFoundException e) {
>              throw new IllegalArgumentException(
> 
> Modified: commons/proper/pool/trunk/src/test/java/org/apache/commons/
> pool2/impl/TestGenericObjectPool.java
> URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/
> test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java?
> rev=1767714&r1=1767713&r2=1767714&view=diff
> ============================================================
> ==================
> --- commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
> (original)
> +++ commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
> Wed Nov  2 15:53:08 2016
> @@ -1080,6 +1080,14 @@ public class TestGenericObjectPool exten
>              // expected
>          }
> 
> +        try {
> +            pool.setEvictionPolicyClassName(java.lang.String.class.
> getName());
> +            fail("setEvictionPolicyClassName must throw an error if a
> class that does not "
> +                    + "implement EvictionPolicy is specified.");
> +        } catch (final IllegalArgumentException e) {
> +            // expected
> +        }
> +
>          pool.setEvictionPolicyClassName(TestEvictionPolicy.class.
> getName());
>          assertEquals(TestEvictionPolicy.class.getName(), pool.
> getEvictionPolicyClassName());
> 
> @@ -1704,49 +1712,49 @@ public class TestGenericObjectPool exten
>          public SimpleFactory() {
>              this(true);
>          }
> -
> +
>          public SimpleFactory(final boolean valid) {
>              this(valid,valid);
>          }
> -
> +
>          public SimpleFactory(final boolean evalid, final boolean ovalid) {
>              evenValid = evalid;
>              oddValid = ovalid;
>          }
> -
> +
>          public synchronized void setValid(final boolean valid) {
>              setEvenValid(valid);
>              setOddValid(valid);
>          }
> -
> +
>          public synchronized void setEvenValid(final boolean valid) {
>              evenValid = valid;
>          }
> -
> +
>          public synchronized void setOddValid(final boolean valid) {
>              oddValid = valid;
>          }
> -
> +
>          public synchronized void setThrowExceptionOnPassivate(final
> boolean bool) {
>              exceptionOnPassivate = bool;
>          }
> -
> +
>          public synchronized void setMaxTotal(final int maxTotal) {
>              this.maxTotal = maxTotal;
>          }
> -
> +
>          public synchronized void setDestroyLatency(final long
> destroyLatency) {
>              this.destroyLatency = destroyLatency;
>          }
> -
> +
>          public synchronized void setMakeLatency(final long makeLatency) {
>              this.makeLatency = makeLatency;
>          }
> -
> +
>          public synchronized void setValidateLatency(final long
> validateLatency) {
>              this.validateLatency = validateLatency;
>          }
> -
> +
>          @Override
>          public PooledObject<String> makeObject() {
>              final long waitLatency;
> @@ -1767,7 +1775,7 @@ public class TestGenericObjectPool exten
>              }
>              return new DefaultPooledObject<String>(
> String.valueOf(counter));
>          }
> -
> +
>          @Override
>          public void destroyObject(final PooledObject<String> obj) throws
> Exception {
>              final long waitLatency;
> @@ -1786,7 +1794,7 @@ public class TestGenericObjectPool exten
>                  throw new Exception();
>              }
>          }
> -
> +
>          @Override
>          public boolean validateObject(final PooledObject<String> obj) {
>              final boolean validate;
> @@ -1809,7 +1817,7 @@ public class TestGenericObjectPool exten
>              }
>              return true;
>          }
> -
> +
>          @Override
>          public void activateObject(final PooledObject<String> obj) throws
> Exception {
>              final boolean hurl;
> @@ -1828,7 +1836,7 @@ public class TestGenericObjectPool exten
>                  }
>              }
>          }
> -
> +
>          @Override
>          public void passivateObject(final PooledObject<String> obj) throws
> Exception {
>              final boolean hurl;
> 
> 
> 
> 
> 


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


Mime
View raw message