Re: svn commit: r1769582 - in /commons/proper/pool/trunk/src: changes/changes.xml main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java

2016-11-14 Thread Mark Thomas
On 15/11/2016 00:44, Keiichi Fujino wrote:
> 2016-11-14 18:44 GMT+09:00 :
> 
>> Author: markt
>> Date: Mon Nov 14 09:44:18 2016
>> New Revision: 1769582



> JavaDoc(get/setEvictorShutdownTimeoutMillis) says
> evictorShutdownTimeoutMillis is milliseconds.
> So, will TimeUnit.SECONDS change to TimeUnit.MILLISECONDS?

Fixed. Thanks.

Mark


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



Re: svn commit: r1769582 - in /commons/proper/pool/trunk/src: changes/changes.xml main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java

2016-11-14 Thread Keiichi Fujino
2016-11-14 18:44 GMT+09:00 <ma...@apache.org>:

> Author: markt
> Date: Mon Nov 14 09:44:18 2016
> New Revision: 1769582
>
> URL: http://svn.apache.org/viewvc?rev=1769582=rev
> Log:
> Additional fix for POOL-315.
> Thanks to Keiichi Fujino
> Also review previous fix.
>
> Modified:
> commons/proper/pool/trunk/src/changes/changes.xml
> commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/
> BaseGenericObjectPool.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=1769582=1769581=1769582=diff
> ====
> ==
> --- commons/proper/pool/trunk/src/changes/changes.xml (original)
> +++ commons/proper/pool/trunk/src/changes/changes.xml Mon Nov 14 09:44:18
> 2016
> @@ -71,7 +71,7 @@ The  type attribute can be add,u
>Ensure that any class name used for evictionPolicyClassName
> represents a
>class that implements EvictionPolicy.
>  
> -
> + due-to="KeiichiFujino">
>Add a configurable delay (default 10 seconds) to wait when shutting
> down
>an Evictor to allow the associated thread time to complete and
> current
>evictions and to terminate.
>
> 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=1769582=1769581=1769582=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
> Mon Nov 14 09:44:18 2016
> @@ -88,7 +88,7 @@ public abstract class BaseGenericObjectP
>  private volatile long softMinEvictableIdleTimeMillis =
>  BaseObjectPoolConfig.DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_
> MILLIS;
>  private volatile EvictionPolicy evictionPolicy;
> -private long evictorShutdownTimeoutMillis =
> +private volatile long evictorShutdownTimeoutMillis =
>  BaseObjectPoolConfig.DEFAULT_EVICTOR_SHUTDOWN_TIMEOUT_MILLIS;
>
>
> @@ -643,7 +643,7 @@ public abstract class BaseGenericObjectP
>   * @return  The timeout in milliseconds that will be used while
> waiting for
>   *  the Evictor to shut down.
>   */
> -public long getEvictorShutdownTimeoutMillis() {
> +public final long getEvictorShutdownTimeoutMillis() {
>  return evictorShutdownTimeoutMillis;
>  }
>
> @@ -656,7 +656,7 @@ public abstract class BaseGenericObjectP
>   *  will be used while waiting
> for the
>   *  Evictor to shut down.
>   */
> -public void setEvictorShutdownTimeoutMillis(
> +public final void setEvictorShutdownTimeoutMillis(
>  final long evictorShutdownTimeoutMillis) {
>  this.evictorShutdownTimeoutMillis = evictorShutdownTimeoutMillis;
>  }
> @@ -720,7 +720,7 @@ public abstract class BaseGenericObjectP
>  final void startEvictor(final long delay) {
>  synchronized (evictionLock) {
>  if (null != evictor) {
> -EvictionTimer.cancel(evictor, 10, TimeUnit.SECONDS);
> +EvictionTimer.cancel(evictor,
> evictorShutdownTimeoutMillis, TimeUnit.SECONDS);
>


Thanks for the fix.

JavaDoc(get/setEvictorShutdownTimeoutMillis) says
evictorShutdownTimeoutMillis is milliseconds.
So, will TimeUnit.SECONDS change to TimeUnit.MILLISECONDS?



>  evictor = null;
>  evictionIterator = null;
>  }
>
> --
> Keiichi.Fujino
>


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/TestGe

2016-11-02 Thread Mark Thomas
On 02/11/2016 20:23, Mark Thomas wrote:
> On 02/11/2016 18:36, Gary Gregory wrote:
>> The close() issue seems worth getting in for 2.4.3 IMO.
> 
> Agreed. I almost have that fixed (need to complete a few memory leak
> checks in Tomcat).
> 
> It is going to need to new configuration option to control how long to
> wait for the executor to stop. That probably means 2.5 rather than 2.4.3.

OK. I'm done with open Pool 2.x bugs. There are still some enhancement
requests but none of them represent itches I want to scratch at this point.

Mark


> 
> Mark
> 
> 
>>
>> G
>>
>> On Wed, Nov 2, 2016 at 11:29 AM, Mark Thomas <ma...@apache.org> wrote:
>>
>>> 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: <ma...@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: comm...@commons.apache.org
>>>>
>>>>
>>>> Author: markt
>>>> Date: Wed Nov  2 15:53:08 2016
>>>> New Revision: 1767714
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1767714=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=1767713=1767714=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  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.
>>>>  
>>>> +
>>>> +  Ensure that any class name used for evictionPolicyClassName
>>>> represents a
>>>> +  class that implements EvictionPolicy.
>>>> +
>>>>
>>>>>>>   "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=1767713=1767714=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 evicPolicy = (EvictionPolicy)
>>> policy;
>>>>  this.evictionPolicy = evicPolicy;
>>>> +} else {
>>>> +throw new IllegalArgumentException("[" +
>>>> evictionPolicyClassName +
>>>> +"] does not implement EvictionPolicy");
>>>>  }
>>>>  } catch (final ClassNotFoundException e) {
>>>>   

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/TestGe

2016-11-02 Thread Mark Thomas
On 02/11/2016 18:36, Gary Gregory wrote:
> The close() issue seems worth getting in for 2.4.3 IMO.

Agreed. I almost have that fixed (need to complete a few memory leak
checks in Tomcat).

It is going to need to new configuration option to control how long to
wait for the executor to stop. That probably means 2.5 rather than 2.4.3.

Mark


> 
> G
> 
> On Wed, Nov 2, 2016 at 11:29 AM, Mark Thomas <ma...@apache.org> wrote:
> 
>> 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: <ma...@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: comm...@commons.apache.org
>>>
>>>
>>> Author: markt
>>> Date: Wed Nov  2 15:53:08 2016
>>> New Revision: 1767714
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1767714=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=1767713=1767714=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  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.
>>>  
>>> +
>>> +  Ensure that any class name used for evictionPolicyClassName
>>> represents a
>>> +  class that implements EvictionPolicy.
>>> +
>>>
>>>>>   "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=1767713=1767714=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 evicPolicy = (EvictionPolicy)
>> 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=1767713=1767714=diff
>>> 
>>> ==
>>> --- commons/proper/pool/trunk/src/test/java/org/apache/commons/
>> pool2/

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/TestGe

2016-11-02 Thread Gary Gregory
The close() issue seems worth getting in for 2.4.3 IMO.

G

On Wed, Nov 2, 2016 at 11:29 AM, Mark Thomas <ma...@apache.org> wrote:

> 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: <ma...@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: comm...@commons.apache.org
> >
> >
> > Author: markt
> > Date: Wed Nov  2 15:53:08 2016
> > New Revision: 1767714
> >
> > URL: http://svn.apache.org/viewvc?rev=1767714=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=1767713=1767714=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  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.
> >  
> > +
> > +  Ensure that any class name used for evictionPolicyClassName
> > represents a
> > +  class that implements EvictionPolicy.
> > +
> >
> > >   "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=1767713=1767714=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 evicPolicy = (EvictionPolicy)
> 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=1767713=1767714=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 "
> > ++ "

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/TestGe

2016-11-02 Thread Mark Thomas
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: <ma...@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: comm...@commons.apache.org
> 
> 
> Author: markt
> Date: Wed Nov  2 15:53:08 2016
> New Revision: 1767714
> 
> URL: http://svn.apache.org/viewvc?rev=1767714=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=1767713=1767714=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  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.
>  
> +
> +  Ensure that any class name used for evictionPolicyClassName
> represents a
> +  class that implements EvictionPolicy.
> +
>
>   "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=1767713=1767714=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 evicPolicy = (EvictionPolicy) 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=1767713=1767714=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);
>  }

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/TestGeneri

2016-11-02 Thread Gary Gregory
Is it time to push out 2.4.3? There are couple of interesting fixes.

Gary
-- Forwarded message --
From: <ma...@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: comm...@commons.apache.org


Author: markt
Date: Wed Nov  2 15:53:08 2016
New Revision: 1767714

URL: http://svn.apache.org/viewvc?rev=1767714=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=1767713=1767714=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  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.
 
+
+  Ensure that any class name used for evictionPolicyClassName
represents a
+  class that implements EvictionPolicy.
+
   
   

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=1767713=1767714=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 evicPolicy = (EvictionPolicy) 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=1767713=1767714=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.maxTo

Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml src/changes/changes.xml

2015-05-19 Thread Mark Thomas
On 19/05/2015 01:51, sebb wrote:
 On 19 May 2015 at 00:45, Phil Steitz phil.ste...@gmail.com wrote:
 On 5/18/15 4:40 PM, ggreg...@apache.org wrote:
 Author: ggregory
 Date: Mon May 18 23:40:21 2015
 New Revision: 1680133

 URL: http://svn.apache.org/r1680133
 Log:
 [POOL-295] Update tests from JUnit 4.11 to 4.12.

 Modified:
 commons/proper/pool/trunk/pom.xml
 commons/proper/pool/trunk/src/changes/changes.xml

 Modified: commons/proper/pool/trunk/pom.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1680133r1=1680132r2=1680133view=diff
 ==
 --- commons/proper/pool/trunk/pom.xml (original)
 +++ commons/proper/pool/trunk/pom.xml Mon May 18 23:40:21 2015
 @@ -117,7 +117,7 @@
  dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
 -  version4.11/version
 +  version4.12/version
scopetest/scope
  /dependency
  dependency

 Modified: commons/proper/pool/trunk/src/changes/changes.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1680133r1=1680132r2=1680133view=diff
 ==
 --- commons/proper/pool/trunk/src/changes/changes.xml (original)
 +++ commons/proper/pool/trunk/src/changes/changes.xml Mon May 18 23:40:21 
 2015
 @@ -70,6 +70,9 @@ The action type attribute can be add,u
  action dev=psteitz type=add issue=POOL-286
Added preparePool method to GenericObjectPool.
  /action
 +action dev=ggregory type=update issue=POOL-295
 +  Update tests from JUnit 4.11 to 4.12.
 +/action

 I don't think we need this kind of change documented in the release
 notes.
 
 Agreed. Nor is a JIRA really necessary.

Disagreed. It is a change and it should be documented.

I do agree a Jira isn't really necessary but I've no objection to one
being created if that is a contributors preferred way of working.

Mark


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



Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml src/changes/changes.xml

2015-05-19 Thread Benedikt Ritter
2015-05-19 8:24 GMT+02:00 Mark Thomas ma...@apache.org:

 On 19/05/2015 01:51, sebb wrote:
  On 19 May 2015 at 00:45, Phil Steitz phil.ste...@gmail.com wrote:
  On 5/18/15 4:40 PM, ggreg...@apache.org wrote:
  Author: ggregory
  Date: Mon May 18 23:40:21 2015
  New Revision: 1680133
 
  URL: http://svn.apache.org/r1680133
  Log:
  [POOL-295] Update tests from JUnit 4.11 to 4.12.
 
  Modified:
  commons/proper/pool/trunk/pom.xml
  commons/proper/pool/trunk/src/changes/changes.xml
 
  Modified: commons/proper/pool/trunk/pom.xml
  URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1680133r1=1680132r2=1680133view=diff
 
 ==
  --- commons/proper/pool/trunk/pom.xml (original)
  +++ commons/proper/pool/trunk/pom.xml Mon May 18 23:40:21 2015
  @@ -117,7 +117,7 @@
   dependency
 groupIdjunit/groupId
 artifactIdjunit/artifactId
  -  version4.11/version
  +  version4.12/version
 scopetest/scope
   /dependency
   dependency
 
  Modified: commons/proper/pool/trunk/src/changes/changes.xml
  URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1680133r1=1680132r2=1680133view=diff
 
 ==
  --- commons/proper/pool/trunk/src/changes/changes.xml (original)
  +++ commons/proper/pool/trunk/src/changes/changes.xml Mon May 18
 23:40:21 2015
  @@ -70,6 +70,9 @@ The action type attribute can be add,u
   action dev=psteitz type=add issue=POOL-286
 Added preparePool method to GenericObjectPool.
   /action
  +action dev=ggregory type=update issue=POOL-295
  +  Update tests from JUnit 4.11 to 4.12.
  +/action
 
  I don't think we need this kind of change documented in the release
  notes.
 
  Agreed. Nor is a JIRA really necessary.

 Disagreed. It is a change and it should be documented.


But a change in test dependencies will not (or at least should not ;-) have
any effect on clients. So why clutter release notes with this kind of
changes?



 I do agree a Jira isn't really necessary but I've no objection to one
 being created if that is a contributors preferred way of working.

 Mark


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




-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter


Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml src/changes/changes.xml

2015-05-19 Thread Benedikt Ritter
I do add this kind of changes to changes.xml if it they have been
contributed. In this case I think attribution of the contributor is more
important. What do you think about that?

Benedikt

2015-05-19 7:56 GMT+02:00 Gary Gregory garydgreg...@gmail.com:

 Done.

 Thank you for keeping a keen eye on commits! :-)

 Gary

 On Mon, May 18, 2015 at 8:09 PM, Phil Steitz phil.ste...@gmail.com
 wrote:

  Not a big deal.  I would just delete the changes entries and that only
  because the release notes are generated from them.
 
  Phil
 
 
 
   On May 18, 2015, at 7:38 PM, Gary Gregory garydgreg...@gmail.com
  wrote:
  
   Should I undo the changes.xml and delete the JIRA or just not do it in
  the
   future?
  
   Gary
  
   On Mon, May 18, 2015 at 5:51 PM, sebb seb...@gmail.com wrote:
  
   On 19 May 2015 at 00:45, Phil Steitz phil.ste...@gmail.com wrote:
   On 5/18/15 4:40 PM, ggreg...@apache.org wrote:
   Author: ggregory
   Date: Mon May 18 23:40:21 2015
   New Revision: 1680133
  
   URL: http://svn.apache.org/r1680133
   Log:
   [POOL-295] Update tests from JUnit 4.11 to 4.12.
  
   Modified:
  commons/proper/pool/trunk/pom.xml
  commons/proper/pool/trunk/src/changes/changes.xml
  
   Modified: commons/proper/pool/trunk/pom.xml
   URL:
  
 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1680133r1=1680132r2=1680133view=diff
  
 
 ==
   --- commons/proper/pool/trunk/pom.xml (original)
   +++ commons/proper/pool/trunk/pom.xml Mon May 18 23:40:21 2015
   @@ -117,7 +117,7 @@
   dependency
 groupIdjunit/groupId
 artifactIdjunit/artifactId
   -  version4.11/version
   +  version4.12/version
 scopetest/scope
   /dependency
   dependency
  
   Modified: commons/proper/pool/trunk/src/changes/changes.xml
   URL:
  
 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1680133r1=1680132r2=1680133view=diff
  
 
 ==
   --- commons/proper/pool/trunk/src/changes/changes.xml (original)
   +++ commons/proper/pool/trunk/src/changes/changes.xml Mon May 18
   23:40:21 2015
   @@ -70,6 +70,9 @@ The action type attribute can be add,u
   action dev=psteitz type=add issue=POOL-286
 Added preparePool method to GenericObjectPool.
   /action
   +action dev=ggregory type=update issue=POOL-295
   +  Update tests from JUnit 4.11 to 4.12.
   +/action
  
   I don't think we need this kind of change documented in the release
   notes.
  
   Agreed. Nor is a JIRA really necessary.
  
   Phil
 /release
 release version=2.3 date=2014-12-30 description=
   This is a maintenance release that includes bug fixes and minor
   enhancements.
  
  
   -
   To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
   For additional commands, e-mail: dev-h...@commons.apache.org
  
   -
   To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
   For additional commands, e-mail: dev-h...@commons.apache.org
  
  
   --
   E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
   Java Persistence with Hibernate, Second Edition
   http://www.manning.com/bauer3/
   JUnit in Action, Second Edition http://www.manning.com/tahchiev/
   Spring Batch in Action http://www.manning.com/templier/
   Blog: http://garygregory.wordpress.com
   Home: http://garygregory.com/
   Tweet! http://twitter.com/GaryGregory
 
  -
  To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
  For additional commands, e-mail: dev-h...@commons.apache.org
 
 


 --
 E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
 Java Persistence with Hibernate, Second Edition
 http://www.manning.com/bauer3/
 JUnit in Action, Second Edition http://www.manning.com/tahchiev/
 Spring Batch in Action http://www.manning.com/templier/
 Blog: http://garygregory.wordpress.com
 Home: http://garygregory.com/
 Tweet! http://twitter.com/GaryGregory




-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter


Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml src/changes/changes.xml

2015-05-19 Thread Gary Gregory
That is a subtle distinction that is irrelevant IMO. We note certain kind of 
changes or we do not, we have to pick the audience, users or developers or 
both. Provenance is not a qualifying factor for this decision IMO. Since jar 
hell can still be an issue for some projects, it might serve some users to know 
the dependency tree has changed.
Gary 

 Original message 
From: Benedikt Ritter brit...@apache.org 
Date: 05/18/2015  23:21  (GMT-08:00) 
To: Commons Developers List dev@commons.apache.org 
Subject: Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml 
src/changes/changes.xml 

I do add this kind of changes to changes.xml if it they have been
contributed. In this case I think attribution of the contributor is more
important. What do you think about that?

Benedikt

2015-05-19 7:56 GMT+02:00 Gary Gregory garydgreg...@gmail.com:

 Done.

 Thank you for keeping a keen eye on commits! :-)

 Gary

 On Mon, May 18, 2015 at 8:09 PM, Phil Steitz phil.ste...@gmail.com
 wrote:

  Not a big deal.  I would just delete the changes entries and that only
  because the release notes are generated from them.
 
  Phil
 
 
 
   On May 18, 2015, at 7:38 PM, Gary Gregory garydgreg...@gmail.com
  wrote:
  
   Should I undo the changes.xml and delete the JIRA or just not do it in
  the
   future?
  
   Gary
  
   On Mon, May 18, 2015 at 5:51 PM, sebb seb...@gmail.com wrote:
  
   On 19 May 2015 at 00:45, Phil Steitz phil.ste...@gmail.com wrote:
   On 5/18/15 4:40 PM, ggreg...@apache.org wrote:
   Author: ggregory
   Date: Mon May 18 23:40:21 2015
   New Revision: 1680133
  
   URL: http://svn.apache.org/r1680133
   Log:
   [POOL-295] Update tests from JUnit 4.11 to 4.12.
  
   Modified:
      commons/proper/pool/trunk/pom.xml
      commons/proper/pool/trunk/src/changes/changes.xml
  
   Modified: commons/proper/pool/trunk/pom.xml
   URL:
  
 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1680133r1=1680132r2=1680133view=diff
  
 
 ==
   --- commons/proper/pool/trunk/pom.xml (original)
   +++ commons/proper/pool/trunk/pom.xml Mon May 18 23:40:21 2015
   @@ -117,7 +117,7 @@
   dependency
     groupIdjunit/groupId
     artifactIdjunit/artifactId
   -  version4.11/version
   +  version4.12/version
     scopetest/scope
   /dependency
   dependency
  
   Modified: commons/proper/pool/trunk/src/changes/changes.xml
   URL:
  
 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1680133r1=1680132r2=1680133view=diff
  
 
 ==
   --- commons/proper/pool/trunk/src/changes/changes.xml (original)
   +++ commons/proper/pool/trunk/src/changes/changes.xml Mon May 18
   23:40:21 2015
   @@ -70,6 +70,9 @@ The action type attribute can be add,u
   action dev=psteitz type=add issue=POOL-286
     Added preparePool method to GenericObjectPool.
   /action
   +    action dev=ggregory type=update issue=POOL-295
   +  Update tests from JUnit 4.11 to 4.12.
   +    /action
  
   I don't think we need this kind of change documented in the release
   notes.
  
   Agreed. Nor is a JIRA really necessary.
  
   Phil
     /release
     release version=2.3 date=2014-12-30 description=
   This is a maintenance release that includes bug fixes and minor
   enhancements.
  
  
   -
   To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
   For additional commands, e-mail: dev-h...@commons.apache.org
  
   -
   To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
   For additional commands, e-mail: dev-h...@commons.apache.org
  
  
   --
   E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
   Java Persistence with Hibernate, Second Edition
   http://www.manning.com/bauer3/
   JUnit in Action, Second Edition http://www.manning.com/tahchiev/
   Spring Batch in Action http://www.manning.com/templier/
   Blog: http://garygregory.wordpress.com
   Home: http://garygregory.com/
   Tweet! http://twitter.com/GaryGregory
 
  -
  To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
  For additional commands, e-mail: dev-h...@commons.apache.org
 
 


 --
 E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
 Java Persistence with Hibernate, Second Edition
 http://www.manning.com/bauer3/
 JUnit in Action, Second Edition http://www.manning.com/tahchiev/
 Spring Batch in Action http://www.manning.com/templier/
 Blog: http://garygregory.wordpress.com
 Home: http://garygregory.com/
 Tweet! http://twitter.com/GaryGregory




-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter


Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml src/changes/changes.xml

2015-05-19 Thread Phil Steitz
On 5/18/15 11:41 PM, Benedikt Ritter wrote:
 2015-05-19 8:24 GMT+02:00 Mark Thomas ma...@apache.org:

 On 19/05/2015 01:51, sebb wrote:
 On 19 May 2015 at 00:45, Phil Steitz phil.ste...@gmail.com wrote:
 On 5/18/15 4:40 PM, ggreg...@apache.org wrote:
 Author: ggregory
 Date: Mon May 18 23:40:21 2015
 New Revision: 1680133

 URL: http://svn.apache.org/r1680133
 Log:
 [POOL-295] Update tests from JUnit 4.11 to 4.12.

 Modified:
 commons/proper/pool/trunk/pom.xml
 commons/proper/pool/trunk/src/changes/changes.xml

 Modified: commons/proper/pool/trunk/pom.xml
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1680133r1=1680132r2=1680133view=diff
 ==
 --- commons/proper/pool/trunk/pom.xml (original)
 +++ commons/proper/pool/trunk/pom.xml Mon May 18 23:40:21 2015
 @@ -117,7 +117,7 @@
  dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
 -  version4.11/version
 +  version4.12/version
scopetest/scope
  /dependency
  dependency

 Modified: commons/proper/pool/trunk/src/changes/changes.xml
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1680133r1=1680132r2=1680133view=diff
 ==
 --- commons/proper/pool/trunk/src/changes/changes.xml (original)
 +++ commons/proper/pool/trunk/src/changes/changes.xml Mon May 18
 23:40:21 2015
 @@ -70,6 +70,9 @@ The action type attribute can be add,u
  action dev=psteitz type=add issue=POOL-286
Added preparePool method to GenericObjectPool.
  /action
 +action dev=ggregory type=update issue=POOL-295
 +  Update tests from JUnit 4.11 to 4.12.
 +/action
 I don't think we need this kind of change documented in the release
 notes.
 Agreed. Nor is a JIRA really necessary.
 Disagreed. It is a change and it should be documented.

 But a change in test dependencies will not (or at least should not ;-) have
 any effect on clients. So why clutter release notes with this kind of
 changes?

That was my point.  What goes in changes.xml is what goes into the
release notes.  Personally, I don't think updating test dependencies
belongs in there.  If others disagree, I am OK erring on the side of
inclusion when it comes to release notes.

Phil


 I do agree a Jira isn't really necessary but I've no objection to one
 being created if that is a contributors preferred way of working.

 Mark


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






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



Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml src/changes/changes.xml

2015-05-18 Thread Gary Gregory
Done.

Thank you for keeping a keen eye on commits! :-)

Gary

On Mon, May 18, 2015 at 8:09 PM, Phil Steitz phil.ste...@gmail.com wrote:

 Not a big deal.  I would just delete the changes entries and that only
 because the release notes are generated from them.

 Phil



  On May 18, 2015, at 7:38 PM, Gary Gregory garydgreg...@gmail.com
 wrote:
 
  Should I undo the changes.xml and delete the JIRA or just not do it in
 the
  future?
 
  Gary
 
  On Mon, May 18, 2015 at 5:51 PM, sebb seb...@gmail.com wrote:
 
  On 19 May 2015 at 00:45, Phil Steitz phil.ste...@gmail.com wrote:
  On 5/18/15 4:40 PM, ggreg...@apache.org wrote:
  Author: ggregory
  Date: Mon May 18 23:40:21 2015
  New Revision: 1680133
 
  URL: http://svn.apache.org/r1680133
  Log:
  [POOL-295] Update tests from JUnit 4.11 to 4.12.
 
  Modified:
 commons/proper/pool/trunk/pom.xml
 commons/proper/pool/trunk/src/changes/changes.xml
 
  Modified: commons/proper/pool/trunk/pom.xml
  URL:
 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1680133r1=1680132r2=1680133view=diff
 
 ==
  --- commons/proper/pool/trunk/pom.xml (original)
  +++ commons/proper/pool/trunk/pom.xml Mon May 18 23:40:21 2015
  @@ -117,7 +117,7 @@
  dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
  -  version4.11/version
  +  version4.12/version
scopetest/scope
  /dependency
  dependency
 
  Modified: commons/proper/pool/trunk/src/changes/changes.xml
  URL:
 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1680133r1=1680132r2=1680133view=diff
 
 ==
  --- commons/proper/pool/trunk/src/changes/changes.xml (original)
  +++ commons/proper/pool/trunk/src/changes/changes.xml Mon May 18
  23:40:21 2015
  @@ -70,6 +70,9 @@ The action type attribute can be add,u
  action dev=psteitz type=add issue=POOL-286
Added preparePool method to GenericObjectPool.
  /action
  +action dev=ggregory type=update issue=POOL-295
  +  Update tests from JUnit 4.11 to 4.12.
  +/action
 
  I don't think we need this kind of change documented in the release
  notes.
 
  Agreed. Nor is a JIRA really necessary.
 
  Phil
/release
release version=2.3 date=2014-12-30 description=
  This is a maintenance release that includes bug fixes and minor
  enhancements.
 
 
  -
  To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
  For additional commands, e-mail: dev-h...@commons.apache.org
 
  -
  To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
  For additional commands, e-mail: dev-h...@commons.apache.org
 
 
  --
  E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
  Java Persistence with Hibernate, Second Edition
  http://www.manning.com/bauer3/
  JUnit in Action, Second Edition http://www.manning.com/tahchiev/
  Spring Batch in Action http://www.manning.com/templier/
  Blog: http://garygregory.wordpress.com
  Home: http://garygregory.com/
  Tweet! http://twitter.com/GaryGregory

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




-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition
http://www.manning.com/bauer3/
JUnit in Action, Second Edition http://www.manning.com/tahchiev/
Spring Batch in Action http://www.manning.com/templier/
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml src/changes/changes.xml

2015-05-18 Thread Phil Steitz
Not a big deal.  I would just delete the changes entries and that only because 
the release notes are generated from them.

Phil



 On May 18, 2015, at 7:38 PM, Gary Gregory garydgreg...@gmail.com wrote:
 
 Should I undo the changes.xml and delete the JIRA or just not do it in the
 future?
 
 Gary
 
 On Mon, May 18, 2015 at 5:51 PM, sebb seb...@gmail.com wrote:
 
 On 19 May 2015 at 00:45, Phil Steitz phil.ste...@gmail.com wrote:
 On 5/18/15 4:40 PM, ggreg...@apache.org wrote:
 Author: ggregory
 Date: Mon May 18 23:40:21 2015
 New Revision: 1680133
 
 URL: http://svn.apache.org/r1680133
 Log:
 [POOL-295] Update tests from JUnit 4.11 to 4.12.
 
 Modified:
commons/proper/pool/trunk/pom.xml
commons/proper/pool/trunk/src/changes/changes.xml
 
 Modified: commons/proper/pool/trunk/pom.xml
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1680133r1=1680132r2=1680133view=diff
 ==
 --- commons/proper/pool/trunk/pom.xml (original)
 +++ commons/proper/pool/trunk/pom.xml Mon May 18 23:40:21 2015
 @@ -117,7 +117,7 @@
 dependency
   groupIdjunit/groupId
   artifactIdjunit/artifactId
 -  version4.11/version
 +  version4.12/version
   scopetest/scope
 /dependency
 dependency
 
 Modified: commons/proper/pool/trunk/src/changes/changes.xml
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1680133r1=1680132r2=1680133view=diff
 ==
 --- commons/proper/pool/trunk/src/changes/changes.xml (original)
 +++ commons/proper/pool/trunk/src/changes/changes.xml Mon May 18
 23:40:21 2015
 @@ -70,6 +70,9 @@ The action type attribute can be add,u
 action dev=psteitz type=add issue=POOL-286
   Added preparePool method to GenericObjectPool.
 /action
 +action dev=ggregory type=update issue=POOL-295
 +  Update tests from JUnit 4.11 to 4.12.
 +/action
 
 I don't think we need this kind of change documented in the release
 notes.
 
 Agreed. Nor is a JIRA really necessary.
 
 Phil
   /release
   release version=2.3 date=2014-12-30 description=
 This is a maintenance release that includes bug fixes and minor
 enhancements.
 
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
 For additional commands, e-mail: dev-h...@commons.apache.org
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
 For additional commands, e-mail: dev-h...@commons.apache.org
 
 
 -- 
 E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
 Java Persistence with Hibernate, Second Edition
 http://www.manning.com/bauer3/
 JUnit in Action, Second Edition http://www.manning.com/tahchiev/
 Spring Batch in Action http://www.manning.com/templier/
 Blog: http://garygregory.wordpress.com
 Home: http://garygregory.com/
 Tweet! http://twitter.com/GaryGregory

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



Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml src/changes/changes.xml

2015-05-18 Thread sebb
On 19 May 2015 at 00:45, Phil Steitz phil.ste...@gmail.com wrote:
 On 5/18/15 4:40 PM, ggreg...@apache.org wrote:
 Author: ggregory
 Date: Mon May 18 23:40:21 2015
 New Revision: 1680133

 URL: http://svn.apache.org/r1680133
 Log:
 [POOL-295] Update tests from JUnit 4.11 to 4.12.

 Modified:
 commons/proper/pool/trunk/pom.xml
 commons/proper/pool/trunk/src/changes/changes.xml

 Modified: commons/proper/pool/trunk/pom.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1680133r1=1680132r2=1680133view=diff
 ==
 --- commons/proper/pool/trunk/pom.xml (original)
 +++ commons/proper/pool/trunk/pom.xml Mon May 18 23:40:21 2015
 @@ -117,7 +117,7 @@
  dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
 -  version4.11/version
 +  version4.12/version
scopetest/scope
  /dependency
  dependency

 Modified: commons/proper/pool/trunk/src/changes/changes.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1680133r1=1680132r2=1680133view=diff
 ==
 --- commons/proper/pool/trunk/src/changes/changes.xml (original)
 +++ commons/proper/pool/trunk/src/changes/changes.xml Mon May 18 23:40:21 
 2015
 @@ -70,6 +70,9 @@ The action type attribute can be add,u
  action dev=psteitz type=add issue=POOL-286
Added preparePool method to GenericObjectPool.
  /action
 +action dev=ggregory type=update issue=POOL-295
 +  Update tests from JUnit 4.11 to 4.12.
 +/action

 I don't think we need this kind of change documented in the release
 notes.

Agreed. Nor is a JIRA really necessary.

 Phil
/release
release version=2.3 date=2014-12-30 description=
  This is a maintenance release that includes bug fixes and minor 
 enhancements.





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


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



Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml src/changes/changes.xml

2015-05-18 Thread Gary Gregory
Should I undo the changes.xml and delete the JIRA or just not do it in the
future?

Gary

On Mon, May 18, 2015 at 5:51 PM, sebb seb...@gmail.com wrote:

 On 19 May 2015 at 00:45, Phil Steitz phil.ste...@gmail.com wrote:
  On 5/18/15 4:40 PM, ggreg...@apache.org wrote:
  Author: ggregory
  Date: Mon May 18 23:40:21 2015
  New Revision: 1680133
 
  URL: http://svn.apache.org/r1680133
  Log:
  [POOL-295] Update tests from JUnit 4.11 to 4.12.
 
  Modified:
  commons/proper/pool/trunk/pom.xml
  commons/proper/pool/trunk/src/changes/changes.xml
 
  Modified: commons/proper/pool/trunk/pom.xml
  URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1680133r1=1680132r2=1680133view=diff
 
 ==
  --- commons/proper/pool/trunk/pom.xml (original)
  +++ commons/proper/pool/trunk/pom.xml Mon May 18 23:40:21 2015
  @@ -117,7 +117,7 @@
   dependency
 groupIdjunit/groupId
 artifactIdjunit/artifactId
  -  version4.11/version
  +  version4.12/version
 scopetest/scope
   /dependency
   dependency
 
  Modified: commons/proper/pool/trunk/src/changes/changes.xml
  URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1680133r1=1680132r2=1680133view=diff
 
 ==
  --- commons/proper/pool/trunk/src/changes/changes.xml (original)
  +++ commons/proper/pool/trunk/src/changes/changes.xml Mon May 18
 23:40:21 2015
  @@ -70,6 +70,9 @@ The action type attribute can be add,u
   action dev=psteitz type=add issue=POOL-286
 Added preparePool method to GenericObjectPool.
   /action
  +action dev=ggregory type=update issue=POOL-295
  +  Update tests from JUnit 4.11 to 4.12.
  +/action
 
  I don't think we need this kind of change documented in the release
  notes.

 Agreed. Nor is a JIRA really necessary.

  Phil
 /release
 release version=2.3 date=2014-12-30 description=
   This is a maintenance release that includes bug fixes and minor
 enhancements.
 
 
 
 
 
  -
  To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
  For additional commands, e-mail: dev-h...@commons.apache.org
 

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




-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition
http://www.manning.com/bauer3/
JUnit in Action, Second Edition http://www.manning.com/tahchiev/
Spring Batch in Action http://www.manning.com/templier/
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: svn commit: r1680133 - in /commons/proper/pool/trunk: pom.xml src/changes/changes.xml

2015-05-18 Thread Phil Steitz
On 5/18/15 4:40 PM, ggreg...@apache.org wrote:
 Author: ggregory
 Date: Mon May 18 23:40:21 2015
 New Revision: 1680133

 URL: http://svn.apache.org/r1680133
 Log:
 [POOL-295] Update tests from JUnit 4.11 to 4.12.

 Modified:
 commons/proper/pool/trunk/pom.xml
 commons/proper/pool/trunk/src/changes/changes.xml

 Modified: commons/proper/pool/trunk/pom.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1680133r1=1680132r2=1680133view=diff
 ==
 --- commons/proper/pool/trunk/pom.xml (original)
 +++ commons/proper/pool/trunk/pom.xml Mon May 18 23:40:21 2015
 @@ -117,7 +117,7 @@
  dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
 -  version4.11/version
 +  version4.12/version
scopetest/scope
  /dependency
  dependency

 Modified: commons/proper/pool/trunk/src/changes/changes.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1680133r1=1680132r2=1680133view=diff
 ==
 --- commons/proper/pool/trunk/src/changes/changes.xml (original)
 +++ commons/proper/pool/trunk/src/changes/changes.xml Mon May 18 23:40:21 2015
 @@ -70,6 +70,9 @@ The action type attribute can be add,u
  action dev=psteitz type=add issue=POOL-286
Added preparePool method to GenericObjectPool.
  /action
 +action dev=ggregory type=update issue=POOL-295
 +  Update tests from JUnit 4.11 to 4.12.
 +/action

I don't think we need this kind of change documented in the release
notes.

Phil
/release
release version=2.3 date=2014-12-30 description=
  This is a maintenance release that includes bug fixes and minor 
 enhancements.  





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



Re: svn commit: r1661559 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java

2015-02-23 Thread Benedikt Ritter
Hello Phil,

2015-02-22 21:43 GMT+01:00 pste...@apache.org:

 Author: psteitz
 Date: Sun Feb 22 20:43:30 2015
 New Revision: 1661559

 URL: http://svn.apache.org/r1661559
 Log:
 Added (disabled) tests for JIRA: DBCP-283 and DBCP-284.

 Modified:

 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java

 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=1661559r1=1661558r2=1661559view=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
 Sun Feb 22 20:43:30 2015
 @@ -26,6 +26,7 @@ import static org.junit.Assert.fail;

  import java.lang.management.ManagementFactory;
  import java.util.ArrayList;
 +import java.util.HashSet;
  import java.util.List;
  import java.util.NoSuchElementException;
  import java.util.Random;
 @@ -2398,6 +2399,44 @@ public class TestGenericObjectPool exten

  Assert.assertEquals(1, factory.validateCounter);
  }
 +
 +/**
 + * Verifies that when a factory's makeObject produces instances that
 are not
 + * discernible by equals, the pool can handle them.
 + *
 + * JIRA: POOL-283
 + */
 +//@Test


IMHO it's better to use the @Ignore annotation, because this way ignored
tests will at least show up in reports generated by maven. You can even add
a description why a test is ignored like this:

@Ignore(See POOL-283 in JIRA)


 +public void testEqualsIndiscernible() throws Exception {
 +final HashSetFactory factory = new HashSetFactory();
 +final GenericObjectPoolHashSetString pool = new
 GenericObjectPoolHashSetString(
 +factory, new GenericObjectPoolConfig());
 +final HashSetString s1 = pool.borrowObject();
 +final HashSetString s2 = pool.borrowObject();
 +pool.returnObject(s1);
 +pool.returnObject(s2);
 +pool.close();
 +}
 +
 +/**
 + * Verifies that when a borrowed object is mutated in a way that does
 not
 + * preserve equality and hashcode, the pool can recognized it on
 return.
 + *
 + * JIRA: POOL-284
 + */
 +//@Test
 +public void testMutable() throws Exception {
 +final HashSetFactory factory = new HashSetFactory();
 +final GenericObjectPoolHashSetString pool = new
 GenericObjectPoolHashSetString(
 +factory, new GenericObjectPoolConfig());
 +final HashSetString s1 = pool.borrowObject();
 +final HashSetString s2 = pool.borrowObject();
 +s1.add(One);
 +s2.add(One);
 +pool.returnObject(s1);
 +pool.returnObject(s2);
 +pool.close();
 +}

  private static final class DummyFactory
  extends BasePooledObjectFactoryObject {
 @@ -2410,7 +2449,23 @@ public class TestGenericObjectPool exten
  return new DefaultPooledObjectObject(value);
  }
  }
 -
 +
 +/**
 + * Factory that creates HashSets.  Note that this means
 + *  0) All instances are initially equal (not discernible by equals)
 + *  1) Instances are mutable and mutation can cause change in
 identity / hashcode.
 + */
 +private static final class HashSetFactory
 +extends BasePooledObjectFactoryHashSetString {
 +@Override
 +public HashSetString create() throws Exception {
 +return new HashSetString();
 +}
 +@Override
 +public PooledObjectHashSetString wrap(HashSetString value) {
 +return new DefaultPooledObjectHashSetString(value);
 +}
 +}

  private static class InvalidFactory
  extends BasePooledObjectFactoryObject {





-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter


Re: svn commit: r1661559 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java

2015-02-23 Thread sebb
On 23 February 2015 at 10:35, Benedikt Ritter brit...@apache.org wrote:
 Hello Phil,

 2015-02-22 21:43 GMT+01:00 pste...@apache.org:

 Author: psteitz
 Date: Sun Feb 22 20:43:30 2015
 New Revision: 1661559

 URL: http://svn.apache.org/r1661559
 Log:
 Added (disabled) tests for JIRA: DBCP-283 and DBCP-284.

 Modified:

 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java

 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=1661559r1=1661558r2=1661559view=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
 Sun Feb 22 20:43:30 2015
 @@ -26,6 +26,7 @@ import static org.junit.Assert.fail;

  import java.lang.management.ManagementFactory;
  import java.util.ArrayList;
 +import java.util.HashSet;
  import java.util.List;
  import java.util.NoSuchElementException;
  import java.util.Random;
 @@ -2398,6 +2399,44 @@ public class TestGenericObjectPool exten

  Assert.assertEquals(1, factory.validateCounter);
  }
 +
 +/**
 + * Verifies that when a factory's makeObject produces instances that
 are not
 + * discernible by equals, the pool can handle them.
 + *
 + * JIRA: POOL-283
 + */
 +//@Test


 IMHO it's better to use the @Ignore annotation, because this way ignored
 tests will at least show up in reports generated by maven. You can even add
 a description why a test is ignored like this:

 @Ignore(See POOL-283 in JIRA)


+1

 +public void testEqualsIndiscernible() throws Exception {
 +final HashSetFactory factory = new HashSetFactory();
 +final GenericObjectPoolHashSetString pool = new
 GenericObjectPoolHashSetString(
 +factory, new GenericObjectPoolConfig());
 +final HashSetString s1 = pool.borrowObject();
 +final HashSetString s2 = pool.borrowObject();
 +pool.returnObject(s1);
 +pool.returnObject(s2);
 +pool.close();
 +}
 +
 +/**
 + * Verifies that when a borrowed object is mutated in a way that does
 not
 + * preserve equality and hashcode, the pool can recognized it on
 return.
 + *
 + * JIRA: POOL-284
 + */
 +//@Test
 +public void testMutable() throws Exception {
 +final HashSetFactory factory = new HashSetFactory();
 +final GenericObjectPoolHashSetString pool = new
 GenericObjectPoolHashSetString(
 +factory, new GenericObjectPoolConfig());
 +final HashSetString s1 = pool.borrowObject();
 +final HashSetString s2 = pool.borrowObject();
 +s1.add(One);
 +s2.add(One);
 +pool.returnObject(s1);
 +pool.returnObject(s2);
 +pool.close();
 +}

  private static final class DummyFactory
  extends BasePooledObjectFactoryObject {
 @@ -2410,7 +2449,23 @@ public class TestGenericObjectPool exten
  return new DefaultPooledObjectObject(value);
  }
  }
 -
 +
 +/**
 + * Factory that creates HashSets.  Note that this means
 + *  0) All instances are initially equal (not discernible by equals)
 + *  1) Instances are mutable and mutation can cause change in
 identity / hashcode.
 + */
 +private static final class HashSetFactory
 +extends BasePooledObjectFactoryHashSetString {
 +@Override
 +public HashSetString create() throws Exception {
 +return new HashSetString();
 +}
 +@Override
 +public PooledObjectHashSetString wrap(HashSetString value) {
 +return new DefaultPooledObjectHashSetString(value);
 +}
 +}

  private static class InvalidFactory
  extends BasePooledObjectFactoryObject {





 --
 http://people.apache.org/~britter/
 http://www.systemoutprintln.de/
 http://twitter.com/BenediktRitter
 http://github.com/britter

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



Re: svn commit: r1647869 - in /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl: TestGenericKeyedObjectPool.java TestGenericObjectPool.java

2014-12-26 Thread Phil Steitz
On 12/25/14 11:50 PM, Bernd wrote:
 Currently cant commit or I would fix it myself, the 50ms from comment
 should be removed (twice)

 // Second borrow does not have to wait on create, average should be about
 50

Good catch.  I will fix this.

 Btw: even without the change the tests worked for me on Windows - it does
 increase the test time rather dramatic, maybe 200ms is better here?

OK, I just cut it down to 200ms.  Lets see if others get failures. 
IIRC you can't count on better than 50ms clock resolution on
Windows.  Current code will work as long as the error is no more
than about 100ms.

Thanks for reviewing!

Phil


 Greetings
 Bernd




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



Re: svn commit: r1647869 - in /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl: TestGenericKeyedObjectPool.java TestGenericObjectPool.java

2014-12-25 Thread Emmanuel Bourg
Le 25/12/2014 04:38, pste...@apache.org a écrit :
 Author: psteitz
 Date: Thu Dec 25 03:38:57 2014
 New Revision: 1647869
 
 URL: http://svn.apache.org/r1647869
 Log:
 Made POOL-259 tests less dependent on system clock resolution.

The tests are ok on Windows now, thank you for the fix Phil.

Emmanuel

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



Re: svn commit: r1647869 - in /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl: TestGenericKeyedObjectPool.java TestGenericObjectPool.java

2014-12-25 Thread Phil Steitz
On 12/25/14 3:15 PM, Emmanuel Bourg wrote:
 Le 25/12/2014 04:38, pste...@apache.org a écrit :
 Author: psteitz
 Date: Thu Dec 25 03:38:57 2014
 New Revision: 1647869

 URL: http://svn.apache.org/r1647869
 Log:
 Made POOL-259 tests less dependent on system clock resolution.
 The tests are ok on Windows now, thank you for the fix Phil.

Thanks for testing!

Phil

 Emmanuel

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




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



Re: svn commit: r1647869 - in /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl: TestGenericKeyedObjectPool.java TestGenericObjectPool.java

2014-12-25 Thread Bernd
Currently cant commit or I would fix it myself, the 50ms from comment
should be removed (twice)

 // Second borrow does not have to wait on create, average should be about
50

Btw: even without the change the tests worked for me on Windows - it does
increase the test time rather dramatic, maybe 200ms is better here?

Greetings
Bernd


Re: svn commit: r1647457 - /commons/proper/pool/trunk/build.xml

2014-12-23 Thread sebb
On 23 December 2014 at 00:13,  pste...@apache.org wrote:
 Author: psteitz
 Date: Tue Dec 23 00:13:57 2014
 New Revision: 1647457

 URL: http://svn.apache.org/r1647457
 Log:
 Updated version, copyright date in footer.

 Modified:
 commons/proper/pool/trunk/build.xml

 Modified: commons/proper/pool/trunk/build.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/build.xml?rev=1647457r1=1647456r2=1647457view=diff
 ==
 --- commons/proper/pool/trunk/build.xml (original)
 +++ commons/proper/pool/trunk/build.xml Tue Dec 23 00:13:57 2014
 @@ -41,7 +41,7 @@

property name=name value=commons-pool2/
property name=title value=Apache Commons Object Pooling Package/
 -  property name=version value=2.2-SNAPSHOT/
 +  property name=version value=2.3-SNAPSHOT/
property name=package value=org.apache.commons.pool2.*/

property name=src.dir value=${basedir}/src/
 @@ -57,7 +57,7 @@
property name=test.failonerror value=true /

property name=javadoc.dir value=${dist.dir}/docs/api/
 -  property name=javadoc.bottom value=lt;smallgt;Copyright 
 amp;copy; 2001-2013 Apache Software Foundation. Documenation generated 
 ${TODAY}lt;/smallgt;./
 +  property name=javadoc.bottom value=lt;smallgt;Copyright 
 amp;copy; 2001-2014 Apache Software Foundation. Documenation generated 
 ${TODAY}lt;/smallgt;./

The current year can be obtained be done as follows:

tstamp
  !-- Used to ensure end-year is up to date --
  format property=THISYEAR pattern=/
/tstamp



property name=javadoc.overview 
 value=${src.java.dir}/org/apache/commons/pool2/overview.html /

property name=javac.optimize value=false/



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



Re: svn commit: r1626998 - in /commons/proper/pool/trunk/src: changes/changes.xml main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java

2014-09-24 Thread Konstantin Kolinko
2014-09-23 17:53 GMT+04:00 Phil Steitz phil.ste...@gmail.com:
 On 9/23/14 6:04 AM, ma...@apache.org wrote:
 Author: markt
 Date: Tue Sep 23 13:04:52 2014
 New Revision: 1626998

 URL: http://svn.apache.org/r1626998
 Log:
 Prevent potential memory leaks when the Pool is dereferenced without being 
 closed.

 Modified:
 commons/proper/pool/trunk/src/changes/changes.xml
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java

(...)

 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=1626998r1=1626997r2=1626998view=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
  Tue Sep 23 13:04:52 2014
 @@ -20,6 +20,7 @@ import java.io.PrintWriter;
  import java.io.StringWriter;
  import java.io.Writer;
  import java.lang.management.ManagementFactory;
 +import java.lang.ref.WeakReference;
  import java.util.Iterator;
  import java.util.TimerTask;
  import java.util.concurrent.atomic.AtomicLong;
 @@ -94,9 +95,10 @@ public abstract class BaseGenericObjectP
  /*
   * Class loader for evictor thread to use since in a J2EE or similar
   * environment the context class loader for the evictor thread may have
 - * visibility of the correct factory. See POOL-161.
 + * visibility of the correct factory. See POOL-161. Uses a weak 
 reference to
 + * avoid potential memory leaks if the Pool is discarded rather than 
 closed.
   */
 -private final ClassLoader factoryClassLoader;
 +private final WeakReferenceClassLoader factoryClassLoader;


  // Monitoring (primarily JMX) attributes
 @@ -137,7 +139,8 @@ public abstract class BaseGenericObjectP
  this.creationStackTrace = getStackTrace(new Exception());

  // save the current CCL to be used later by the evictor Thread
 -factoryClassLoader = Thread.currentThread().getContextClassLoader();
 +factoryClassLoader = new WeakReferenceClassLoader(
 +Thread.currentThread().getContextClassLoader());

I think that Thread.currentThread().getContextClassLoader() may return
null if the pool is used in a standalone application. This will break
the if (cl == null) check added to Evictor.run() method below.

  fairness = config.getFairness();
  }

 @@ -251,7 +254,7 @@ public abstract class BaseGenericObjectP
  public final boolean getLifo() {
  return lifo;
  }
 -
 +
  /**
   * Returns whether or not the pool serves threads waiting to borrow 
 objects fairly.
   * True means that waiting threads are served as if waiting in a FIFO 
 queue.
 @@ -997,8 +1000,14 @@ public abstract class BaseGenericObjectP
  Thread.currentThread().getContextClassLoader();
  try {
  // Set the class loader for the factory
 -Thread.currentThread().setContextClassLoader(
 -factoryClassLoader);
 +ClassLoader cl = factoryClassLoader.get();
 +if (cl == null) {
 +// The pool has been dereferenced and the class loader 
 GC'd.
 +// Cancel this timer so the pool can be GC'd as well.
 +cancel();
 +return;
 +}
 +Thread.currentThread().setContextClassLoader(cl);

  // Evict from the pool
  try {





Best regards,
Konstantin Kolinko

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



Re: svn commit: r1626998 - in /commons/proper/pool/trunk/src: changes/changes.xml main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java

2014-09-24 Thread Mark Thomas
On 24/09/2014 10:49, Konstantin Kolinko wrote:
 2014-09-23 17:53 GMT+04:00 Phil Steitz phil.ste...@gmail.com:
 On 9/23/14 6:04 AM, ma...@apache.org wrote:
 Author: markt
 Date: Tue Sep 23 13:04:52 2014
 New Revision: 1626998

 URL: http://svn.apache.org/r1626998
 Log:
 Prevent potential memory leaks when the Pool is dereferenced without being 
 closed.

 Modified:
 commons/proper/pool/trunk/src/changes/changes.xml
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
 
 (...)
 
 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=1626998r1=1626997r2=1626998view=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
  Tue Sep 23 13:04:52 2014
 @@ -20,6 +20,7 @@ import java.io.PrintWriter;
  import java.io.StringWriter;
  import java.io.Writer;
  import java.lang.management.ManagementFactory;
 +import java.lang.ref.WeakReference;
  import java.util.Iterator;
  import java.util.TimerTask;
  import java.util.concurrent.atomic.AtomicLong;
 @@ -94,9 +95,10 @@ public abstract class BaseGenericObjectP
  /*
   * Class loader for evictor thread to use since in a J2EE or similar
   * environment the context class loader for the evictor thread may have
 - * visibility of the correct factory. See POOL-161.
 + * visibility of the correct factory. See POOL-161. Uses a weak 
 reference to
 + * avoid potential memory leaks if the Pool is discarded rather than 
 closed.
   */
 -private final ClassLoader factoryClassLoader;
 +private final WeakReferenceClassLoader factoryClassLoader;


  // Monitoring (primarily JMX) attributes
 @@ -137,7 +139,8 @@ public abstract class BaseGenericObjectP
  this.creationStackTrace = getStackTrace(new Exception());

  // save the current CCL to be used later by the evictor Thread
 -factoryClassLoader = 
 Thread.currentThread().getContextClassLoader();
 +factoryClassLoader = new WeakReferenceClassLoader(
 +Thread.currentThread().getContextClassLoader());
 
 I think that Thread.currentThread().getContextClassLoader() may return
 null if the pool is used in a standalone application. This will break
 the if (cl == null) check added to Evictor.run() method below.

I did some quick checking. The only way I can get that to return null is
if I use:

Thread.currentThread().setContextClassLoader(null);

I can't think of a valid reason for doing that but I have got a patch
that will protect against this so, give the wide range of code Pool gets
used in, I'll add that protection.

Mark


 
  fairness = config.getFairness();
  }

 @@ -251,7 +254,7 @@ public abstract class BaseGenericObjectP
  public final boolean getLifo() {
  return lifo;
  }
 -
 +
  /**
   * Returns whether or not the pool serves threads waiting to borrow 
 objects fairly.
   * True means that waiting threads are served as if waiting in a FIFO 
 queue.
 @@ -997,8 +1000,14 @@ public abstract class BaseGenericObjectP
  Thread.currentThread().getContextClassLoader();
  try {
  // Set the class loader for the factory
 -Thread.currentThread().setContextClassLoader(
 -factoryClassLoader);
 +ClassLoader cl = factoryClassLoader.get();
 +if (cl == null) {
 +// The pool has been dereferenced and the class loader 
 GC'd.
 +// Cancel this timer so the pool can be GC'd as well.
 +cancel();
 +return;
 +}
 +Thread.currentThread().setContextClassLoader(cl);

  // Evict from the pool
  try {



 
 
 Best regards,
 Konstantin Kolinko
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
 For additional commands, e-mail: dev-h...@commons.apache.org
 


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



Re: svn commit: r1626998 - in /commons/proper/pool/trunk/src: changes/changes.xml main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java

2014-09-23 Thread Phil Steitz
On 9/23/14 6:04 AM, ma...@apache.org wrote:
 Author: markt
 Date: Tue Sep 23 13:04:52 2014
 New Revision: 1626998

 URL: http://svn.apache.org/r1626998
 Log:
 Prevent potential memory leaks when the Pool is dereferenced without being 
 closed.

 Modified:
 commons/proper/pool/trunk/src/changes/changes.xml
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.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=1626998r1=1626997r2=1626998view=diff
 ==
 --- commons/proper/pool/trunk/src/changes/changes.xml (original)
 +++ commons/proper/pool/trunk/src/changes/changes.xml Tue Sep 23 13:04:52 2014
 @@ -80,6 +80,10 @@ The action type attribute can be add,u
  action dev=ggregory type=update issue=POOL-274
Update asm-util to 5.0.3 from 4.0.
  /action
 +action dev=markt type=fix

Fix what?  Should be a JIRA for this if it is a bug.

Phil
 +  Prevent potential memory leaks when the Pool is dereferenced without 
 being
 +  closed.
 +/action
/release
release version=2.2 date=2014-02-24 description=
  This is a maintenance release that adds a new testOnCreate configuration 
 option

 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=1626998r1=1626997r2=1626998view=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
  Tue Sep 23 13:04:52 2014
 @@ -20,6 +20,7 @@ import java.io.PrintWriter;
  import java.io.StringWriter;
  import java.io.Writer;
  import java.lang.management.ManagementFactory;
 +import java.lang.ref.WeakReference;
  import java.util.Iterator;
  import java.util.TimerTask;
  import java.util.concurrent.atomic.AtomicLong;
 @@ -94,9 +95,10 @@ public abstract class BaseGenericObjectP
  /*
   * Class loader for evictor thread to use since in a J2EE or similar
   * environment the context class loader for the evictor thread may have
 - * visibility of the correct factory. See POOL-161.
 + * visibility of the correct factory. See POOL-161. Uses a weak 
 reference to
 + * avoid potential memory leaks if the Pool is discarded rather than 
 closed.
   */
 -private final ClassLoader factoryClassLoader;
 +private final WeakReferenceClassLoader factoryClassLoader;
  
  
  // Monitoring (primarily JMX) attributes
 @@ -137,7 +139,8 @@ public abstract class BaseGenericObjectP
  this.creationStackTrace = getStackTrace(new Exception());
  
  // save the current CCL to be used later by the evictor Thread
 -factoryClassLoader = Thread.currentThread().getContextClassLoader();
 +factoryClassLoader = new WeakReferenceClassLoader(
 +Thread.currentThread().getContextClassLoader());
  fairness = config.getFairness();
  }
  
 @@ -251,7 +254,7 @@ public abstract class BaseGenericObjectP
  public final boolean getLifo() {
  return lifo;
  }
 -
 +
  /**
   * Returns whether or not the pool serves threads waiting to borrow 
 objects fairly.
   * True means that waiting threads are served as if waiting in a FIFO 
 queue.
 @@ -997,8 +1000,14 @@ public abstract class BaseGenericObjectP
  Thread.currentThread().getContextClassLoader();
  try {
  // Set the class loader for the factory
 -Thread.currentThread().setContextClassLoader(
 -factoryClassLoader);
 +ClassLoader cl = factoryClassLoader.get();
 +if (cl == null) {
 +// The pool has been dereferenced and the class loader 
 GC'd.
 +// Cancel this timer so the pool can be GC'd as well.
 +cancel();
 +return;
 +}
 +Thread.currentThread().setContextClassLoader(cl);
  
  // Evict from the pool
  try {





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



Re: svn commit: r1609308 - in /commons/proper/pool/trunk/src: changes/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/commons/pool2/impl/

2014-07-12 Thread Phil Steitz
On 7/9/14, 8:42 PM, Phil Steitz wrote:
 On 7/9/14, 2:29 PM, ma...@apache.org wrote:
 Author: markt
 Date: Wed Jul  9 21:29:44 2014
 New Revision: 1609308

 URL: http://svn.apache.org/r1609308
 Log:
 POOL-263
 Fix a threading issue that meant that concurrent calls to close() and 
 returnObject() could result in some returned objects not being destroyed.

 Modified:
 commons/proper/pool/trunk/src/changes/changes.xml
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.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=1609308r1=1609307r2=1609308view=diff
 ==
 --- commons/proper/pool/trunk/src/changes/changes.xml (original)
 +++ commons/proper/pool/trunk/src/changes/changes.xml Wed Jul  9 21:29:44 
 2014
 @@ -45,6 +45,10 @@ The action type attribute can be add,u
body
release version=2.3 date=TBD description=
  TBD
 +action dev=markt type=fix issue=POOL-263
 +  Fix a threading issue that meant that concurrent calls to close() and
 +  returnObject() could result in some returned objects not being 
 destroyed.
 +/action
  action dev=psteitz type=add issue=POOL-262
Made fairness configurable for GenericObjectPool, 
 GenericKeyedObjectPool.
  /action

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1609308r1=1609307r2=1609308view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Wed Jul  9 21:29:44 2014
 @@ -535,6 +535,12 @@ public class GenericKeyedObjectPoolK,T
  } else {
  idleObjects.addLast(p);
  }
 +if (isClosed()) {
 +// 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)
 +clear(key);
 +}
  }
 Another option here might be to modify LinkedBlockingDeque to
 support close() semantics and have close on the pool close the deque
 (so addLast/First would return false on a closed deque and
 returnObject would just destroy the one object instead of having to
 add it back and then clear it).  I did some benchmarking a while
 back to see if ripping out the capacity checking made any difference
 to performance and was surprised to find that I could not measure
 this.  A closed check might similarly have minimal performance
 impact; or at least swapping out the needless capacity check for a
 closed check might be net zero.
  
  if (hasBorrowWaiters()) {
 @@ -1430,9 +1436,8 @@ public class GenericKeyedObjectPoolK,T
   */
  public ObjectDeque(boolean fairness) {
  idleObjects = new 
 LinkedBlockingDequePooledObjectS(fairness);
 -
  }
 -
 +
  /**
   * Obtain the idle objects for the current key.
   *

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1609308r1=1609307r2=1609308view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  Wed Jul  9 21:29:44 2014
 @@ -111,7 +111,7 @@ public class GenericObjectPoolT extend
  throw new IllegalArgumentException(factory may not be null);
  }
  this.factory = factory;
 -
 +
  idleObjects = new 
 LinkedBlockingDequePooledObjectT(config.getFairness());
  
  setConfig(config);
 @@ -609,6 +609,12 @@ public class GenericObjectPoolT extend
  } else {
  idleObjects.addLast(p);
  }
 +if (isClosed()) {
 +// Pool closed while object was being added to idle objects.
 +// Make sure the returned object is destroyed rather than 
 left

Re: svn commit: r1609308 - in /commons/proper/pool/trunk/src: changes/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/commons/pool2/impl/

2014-07-09 Thread Phil Steitz
On 7/9/14, 2:29 PM, ma...@apache.org wrote:
 Author: markt
 Date: Wed Jul  9 21:29:44 2014
 New Revision: 1609308

 URL: http://svn.apache.org/r1609308
 Log:
 POOL-263
 Fix a threading issue that meant that concurrent calls to close() and 
 returnObject() could result in some returned objects not being destroyed.

 Modified:
 commons/proper/pool/trunk/src/changes/changes.xml
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.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=1609308r1=1609307r2=1609308view=diff
 ==
 --- commons/proper/pool/trunk/src/changes/changes.xml (original)
 +++ commons/proper/pool/trunk/src/changes/changes.xml Wed Jul  9 21:29:44 2014
 @@ -45,6 +45,10 @@ The action type attribute can be add,u
body
release version=2.3 date=TBD description=
  TBD
 +action dev=markt type=fix issue=POOL-263
 +  Fix a threading issue that meant that concurrent calls to close() and
 +  returnObject() could result in some returned objects not being 
 destroyed.
 +/action
  action dev=psteitz type=add issue=POOL-262
Made fairness configurable for GenericObjectPool, 
 GenericKeyedObjectPool.
  /action

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1609308r1=1609307r2=1609308view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Wed Jul  9 21:29:44 2014
 @@ -535,6 +535,12 @@ public class GenericKeyedObjectPoolK,T
  } else {
  idleObjects.addLast(p);
  }
 +if (isClosed()) {
 +// 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)
 +clear(key);
 +}
  }

Another option here might be to modify LinkedBlockingDeque to
support close() semantics and have close on the pool close the deque
(so addLast/First would return false on a closed deque and
returnObject would just destroy the one object instead of having to
add it back and then clear it).  I did some benchmarking a while
back to see if ripping out the capacity checking made any difference
to performance and was surprised to find that I could not measure
this.  A closed check might similarly have minimal performance
impact; or at least swapping out the needless capacity check for a
closed check might be net zero.
  
  if (hasBorrowWaiters()) {
 @@ -1430,9 +1436,8 @@ public class GenericKeyedObjectPoolK,T
   */
  public ObjectDeque(boolean fairness) {
  idleObjects = new LinkedBlockingDequePooledObjectS(fairness);
 -
  }
 -
 +
  /**
   * Obtain the idle objects for the current key.
   *

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1609308r1=1609307r2=1609308view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  Wed Jul  9 21:29:44 2014
 @@ -111,7 +111,7 @@ public class GenericObjectPoolT extend
  throw new IllegalArgumentException(factory may not be null);
  }
  this.factory = factory;
 -
 +
  idleObjects = new 
 LinkedBlockingDequePooledObjectT(config.getFairness());
  
  setConfig(config);
 @@ -609,6 +609,12 @@ public class GenericObjectPoolT extend
  } else {
  idleObjects.addLast(p);
  }
 +if (isClosed()) {
 +// 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

Re: svn commit: r1570586 - /commons/proper/pool/trunk/src/changes/release-notes.vm

2014-02-21 Thread sebb
Thanks, that's perfect.

On 21 February 2014 14:28,  ma...@apache.org wrote:
 Author: markt
 Date: Fri Feb 21 14:28:11 2014
 New Revision: 1570586

 URL: http://svn.apache.org/r1570586
 Log:
 Add more clarification re MBean interfaces.

 Modified:
 commons/proper/pool/trunk/src/changes/release-notes.vm

 Modified: commons/proper/pool/trunk/src/changes/release-notes.vm
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/release-notes.vm?rev=1570586r1=1570585r2=1570586view=diff
 ==
 --- commons/proper/pool/trunk/src/changes/release-notes.vm (original)
 +++ commons/proper/pool/trunk/src/changes/release-notes.vm Fri Feb 21 
 14:28:11 2014
 @@ -23,8 +23,16 @@ Version 2 contains a completely re-writt
  In addition to performance and scalability improvements, version 2 includes 
 robust instance
  tracking and pool monitoring. Version 2 requires JDK level 1.6 or above.

 -No client code changes are required to migrate from version 2.0 to 2.1.  
 Users of version 1.x
 -should consult the migration guide on the Commons Pool web site.
 +No client code changes are required to migrate from version 2.0 or 2.1 to 
 2.2.
 +Users of version 1.x should consult the migration guide on the Commons Pool 
 web site.
 +
 +NOTE: The MBean interfaces (DefaultPooledObjectInfoMBean, 
 GenericKeyedObjectPoolMXBean
 +  and GenericKeyedObjectPoolMXBean) exist only to define the attributes 
 and methods
 +  that will be made available via JMX. They must not be implemented by 
 clients as
 +  they are subject to change between major, minor and patch version 
 releases of
 +  Commons Pool. Clients that implement any of these interfaces may not, 
 therefore,
 +  be able to upgrade to a new minor or patch release without requiring 
 code
 +  changes.

  ## N.B. the available variables are described here:
  ## 
 http://maven.apache.org/plugins/maven-changes-plugin/examples/using-a-custom-announcement-template.html



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



Re: svn commit: r1550655 - in /commons/proper/pool/trunk: doc/ src/changes/changes.xml src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java src/test/java/org/apache/commons/pool2/im

2013-12-12 Thread Phil Steitz
On 12/12/13, 10:32 PM, pste...@apache.org wrote:
 Author: psteitz
 Date: Fri Dec 13 06:32:42 2013
 New Revision: 1550655

 URL: http://svn.apache.org/r1550655
 Log:
 Added missing create counter decrement in GenericKeyedObjectPool create 
 method on factory
 exception path. Prior to this fix, exceptions thrown by factory makeObject 
 calls could leak
 per key capacity.

 JIRA: POOL-243
 Thanks to: Michal Sabo


 Added:
 commons/proper/pool/trunk/doc/

Sorry.  Did not mean to add this directory just yet.  Will add the
files (code examples) in subsequent commit.

 Modified:
 commons/proper/pool/trunk/src/changes/changes.xml
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.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=1550655r1=1550654r2=1550655view=diff
 ==
 --- commons/proper/pool/trunk/src/changes/changes.xml (original)
 +++ commons/proper/pool/trunk/src/changes/changes.xml Fri Dec 13 06:32:42 2013
 @@ -46,6 +46,11 @@ The action type attribute can be add,u
release version=2.1 date=TBD description=
This is a maintenance release that includes a small number of new
 features as well as including bugfixes and test case improvements.
 +action issue=POOL-243 dev=psteitz type=fix duu-to=Michal Sabo
 +  Added missing create counter decrement in GenericKeyedObjectPool 
 create method on factory
 +  exception path. Prior to this fix, exceptions thrown by factory 
 makeObject calls could leak
 +  per key capacity.
 +/action
  action issue=POOL-240 dev=psteitz type=fix due-to=Dan McNulty
Ensured that blocked threads waiting on a depleted pool get served when
objects are destroyed due to validation or passivation failures in

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1550655r1=1550654r2=1550655view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Fri Dec 13 06:32:42 2013
 @@ -1007,6 +1007,7 @@ public class GenericKeyedObjectPoolK,T
  p = factory.makeObject(key);
  } catch (Exception e) {
  numTotal.decrementAndGet();
 +objectDeque.getCreateCount().decrementAndGet();
  throw e;
  }
  

 Modified: 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1550655r1=1550654r2=1550655view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  Fri Dec 13 06:32:42 2013
 @@ -1635,7 +1635,10 @@ public class TestGenericKeyedObjectPool 
  this.valid = valid;
  }
  @Override
 -public PooledObjectString makeObject(K key) {
 +public PooledObjectString makeObject(K key) throws Exception {
 +if (exceptionOnCreate) {
 +throw new Exception();
 +}
  String out = null;
  synchronized(this) {
  activeCount++;
 @@ -1722,6 +1725,7 @@ public class TestGenericKeyedObjectPool 
  boolean exceptionOnPassivate = false;
  boolean exceptionOnActivate = false;
  boolean exceptionOnDestroy = false;
 +boolean exceptionOnCreate = false;
  
  private void doWait(long latency) {
  try {
 @@ -1912,6 +1916,28 @@ public class TestGenericKeyedObjectPool 
  String obj = pool.borrowObject(one);
  pool.returnObject(one, obj);
  }
 +
 +/**
 + * Verify that factory exceptions creating objects do not corrupt per 
 key create count.
 + * 
 + * JIRA: POOL-243
 + */
 +@Test
 +public void testMakeObjectException()
 +throws Exception {
 +SimpleFactoryString factory = new SimpleFactoryString();
 +GenericKeyedObjectPoolString, String pool = new 
 GenericKeyedObjectPoolString, String(factory);
 +pool.setMaxTotalPerKey(1

Re: svn commit: r1538418 - /commons/proper/pool/trunk/build.xml

2013-11-03 Thread Phil Steitz
On 11/3/13 11:03 AM, ma...@apache.org wrote:
 Author: markt
 Date: Sun Nov  3 19:03:22 2013
 New Revision: 1538418

 URL: http://svn.apache.org/r1538418
 Log:
 Document class path requirements

 Modified:
 commons/proper/pool/trunk/build.xml

 Modified: commons/proper/pool/trunk/build.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/build.xml?rev=1538418r1=1538417r2=1538418view=diff
 ==
 --- commons/proper/pool/trunk/build.xml (original)
 +++ commons/proper/pool/trunk/build.xml Sun Nov  3 19:03:22 2013
 @@ -15,6 +15,12 @@
 limitations under the License.
  --
  !-- $Id$ --
 +!--
 +  This build script requires that the class path (set via the classpath 
 property
 +  or the command line class path contains the following libraries:
 +  - JUnit 4.11 or later
 +  - cglib 3.0 or later 
 +--
  project name=commons-pool default=test basedir=.
  
 target name=init




Ignore my last post.  This is good enough.  Please go ahead with
final RC if everything else is ready.

Phil

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



Re: svn commit: r1538479 - /commons/proper/pool/trunk/pom.xml

2013-11-03 Thread Thomas Neidhart
On 11/04/2013 12:43 AM, pste...@apache.org wrote:
 Author: psteitz
 Date: Sun Nov  3 23:43:06 2013
 New Revision: 1538479
 
 URL: http://svn.apache.org/r1538479
 Log:
 Updated componentId to pool2.
 
 Modified:
 commons/proper/pool/trunk/pom.xml
 
 Modified: commons/proper/pool/trunk/pom.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1538479r1=1538478r2=1538479view=diff
 ==
 --- commons/proper/pool/trunk/pom.xml (original)
 +++ commons/proper/pool/trunk/pom.xml Sun Nov  3 23:43:06 2013
 @@ -149,7 +149,7 @@
  
 project.reporting.outputEncodingUTF-8/project.reporting.outputEncoding
  maven.compile.source1.6/maven.compile.source
  maven.compile.target1.6/maven.compile.target
 -commons.componentidpool/commons.componentid
 +commons.componentidpool2/commons.componentid
  commons.release.version2.0/commons.release.version
  commons.release.desc(Java 6.0+)/commons.release.desc
  commons.release.2.version1.6/commons.release.2.version

When updating the componentid you must also add other properties for scm
publishing otherwise it will fail.

See my changes that I have done to the math3 pom yesterday or similar
changes in lang3 / collections4.

Thomas


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



Re: svn commit: r1537461 - in /commons/proper/pool/trunk/src/site/xdoc: issue-tracking.xml mail-lists.xml

2013-10-31 Thread Mark Thomas
On 31/10/2013 12:10, s...@apache.org wrote:
 Author: sebb
 Date: Thu Oct 31 12:10:34 2013
 New Revision: 1537461
 
 URL: http://svn.apache.org/r1537461
 Log:
 Apache branding

Any more changes for Pool in the pipeline or is it safe for me to go
ahead and roll Pool 2.0 RC2?

Mark


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



Re: svn commit: r1537461 - in /commons/proper/pool/trunk/src/site/xdoc: issue-tracking.xml mail-lists.xml

2013-10-31 Thread sebb
On 31 October 2013 12:20, Mark Thomas ma...@apache.org wrote:
 On 31/10/2013 12:10, s...@apache.org wrote:
 Author: sebb
 Date: Thu Oct 31 12:10:34 2013
 New Revision: 1537461

 URL: http://svn.apache.org/r1537461
 Log:
 Apache branding

 Any more changes for Pool in the pipeline or is it safe for me to go
 ahead and roll Pool 2.0 RC2?

There are still a few bare Commons mentions, and I think some
references to pool rather than Pool.
I hope to fix those shortly

 Mark


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


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



Re: svn commit: r1537461 - in /commons/proper/pool/trunk/src/site/xdoc: issue-tracking.xml mail-lists.xml

2013-10-31 Thread sebb
On 31 October 2013 12:51, sebb seb...@gmail.com wrote:
 On 31 October 2013 12:20, Mark Thomas ma...@apache.org wrote:
 On 31/10/2013 12:10, s...@apache.org wrote:
 Author: sebb
 Date: Thu Oct 31 12:10:34 2013
 New Revision: 1537461

 URL: http://svn.apache.org/r1537461
 Log:
 Apache branding

 Any more changes for Pool in the pipeline or is it safe for me to go
 ahead and roll Pool 2.0 RC2?

 There are still a few bare Commons mentions, and I think some
 references to pool rather than Pool.
 I hope to fix those shortly

OK done.

However. I think the Javadoc list in site.xml needs pruning/updating?

Should at least add 1.6.1 and 1.5.7.

Are the earlier Javadocs still useful?

 Mark


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


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



Re: svn commit: r1537461 - in /commons/proper/pool/trunk/src/site/xdoc: issue-tracking.xml mail-lists.xml

2013-10-31 Thread sebb
On 31 October 2013 13:44, Mark Thomas ma...@apache.org wrote:
 On 31/10/2013 12:59, sebb wrote:
 On 31 October 2013 12:51, sebb seb...@gmail.com wrote:
 On 31 October 2013 12:20, Mark Thomas ma...@apache.org wrote:
 On 31/10/2013 12:10, s...@apache.org wrote:
 Author: sebb
 Date: Thu Oct 31 12:10:34 2013
 New Revision: 1537461

 URL: http://svn.apache.org/r1537461
 Log:
 Apache branding

 Any more changes for Pool in the pipeline or is it safe for me to go
 ahead and roll Pool 2.0 RC2?

 There are still a few bare Commons mentions, and I think some
 references to pool rather than Pool.
 I hope to fix those shortly

 OK done.

 However. I think the Javadoc list in site.xml needs pruning/updating?

 Agreed. 1.4 was released almost 5 years ago. I think it is reasonable
 limiting the docs on the site to latest 1.5.x, latest 1.6.x and latest 2.x

 Should at least add 1.6.1 and 1.5.7.

 There has been a 1.6.1 release? I don't see in it the archives.

I assumed there was as it was listed in download_pool.xml, so I
adjusted the pom to suit.
However that file seems to have been copied from 1.X which in turn
seems to have been updated to the next release already.
I'll fix this in Pool 2

 Are the earlier Javadocs still useful?

 I'll leave the files in place for now so external links don't break but
 I'll remove the links to 1.2, 1.3. and 1.4.

 Mark


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


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



Re: svn commit: r1537461 - in /commons/proper/pool/trunk/src/site/xdoc: issue-tracking.xml mail-lists.xml

2013-10-31 Thread sebb
On 31 October 2013 14:36, sebb seb...@gmail.com wrote:
 On 31 October 2013 13:44, Mark Thomas ma...@apache.org wrote:
 On 31/10/2013 12:59, sebb wrote:
 On 31 October 2013 12:51, sebb seb...@gmail.com wrote:
 On 31 October 2013 12:20, Mark Thomas ma...@apache.org wrote:
 On 31/10/2013 12:10, s...@apache.org wrote:
 Author: sebb
 Date: Thu Oct 31 12:10:34 2013
 New Revision: 1537461

 URL: http://svn.apache.org/r1537461
 Log:
 Apache branding

 Any more changes for Pool in the pipeline or is it safe for me to go
 ahead and roll Pool 2.0 RC2?

 There are still a few bare Commons mentions, and I think some
 references to pool rather than Pool.
 I hope to fix those shortly

 OK done.

 However. I think the Javadoc list in site.xml needs pruning/updating?

 Agreed. 1.4 was released almost 5 years ago. I think it is reasonable
 limiting the docs on the site to latest 1.5.x, latest 1.6.x and latest 2.x

 Should at least add 1.6.1 and 1.5.7.

 There has been a 1.6.1 release? I don't see in it the archives.

 I assumed there was as it was listed in download_pool.xml, so I
 adjusted the pom to suit.
 However that file seems to have been copied from 1.X which in turn
 seems to have been updated to the next release already.
 I'll fix this in Pool 2

Actually, only 1.6 is currently available from the the ASF dist area,
so 1.5.7 should be removed from the download page.

 Are the earlier Javadocs still useful?

 I'll leave the files in place for now so external links don't break but
 I'll remove the links to 1.2, 1.3. and 1.4.

 Mark


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


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



Re: svn commit: r1531846 - in /commons/proper/pool/trunk: ./ src/main/java/org/apache/commons/pool2/proxy/ src/test/java/org/apache/commons/pool2/proxy/

2013-10-14 Thread Phil Steitz
On 10/14/13 3:50 AM, ma...@apache.org wrote:
 Author: markt
 Date: Mon Oct 14 10:50:28 2013
 New Revision: 1531846

 URL: http://svn.apache.org/r1531846
 Log:
 Add CGLib proxy implementation and test.

 Added:
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
(with props)
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java
(with props)
 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/proxy/TestProxiedObjectPoolWithCglibProxy.java
(with props)
 Modified:
 commons/proper/pool/trunk/pom.xml

 Modified: commons/proper/pool/trunk/pom.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1531846r1=1531845r2=1531846view=diff
 ==
 --- commons/proper/pool/trunk/pom.xml (original)
 +++ commons/proper/pool/trunk/pom.xml Mon Oct 14 10:50:28 2013
 @@ -120,6 +120,19 @@
version4.11/version
scopetest/scope
  /dependency
 +dependency
 +  groupIdcglib/groupId
 +  artifactIdcglib/artifactId
 +  version3.0/version
 +  scopeprovided/scope
 +/dependency
 +dependency
 +  groupIdorg.ow2.asm/groupId
 +  artifactIdasm-util/artifactId
 +  version4.0/version
 +  scopeprovided/scope
 +/dependency
 +   

 What exactly is expected to provide this?  Does tomcat somehow
provide it?  I guess its obvious from the code what classes depend
on it, right?  Also, this breaks the Ant build, so we either need to
drop the Ant build or fix it.  I am not asking to revert here - just
want to understand the implications.

Phil
  
/dependencies


  
distributionManagement

 Added: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java?rev=1531846view=auto
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
  (added)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
  Mon Oct 14 10:50:28 2013
 @@ -0,0 +1,32 @@
 +package org.apache.commons.pool2.proxy;
 +
 +import java.lang.reflect.Method;
 +
 +import org.apache.commons.pool2.UsageTracking;
 +
 +import net.sf.cglib.proxy.MethodInterceptor;
 +import net.sf.cglib.proxy.MethodProxy;
 +
 +
 +public class CglibProxyHandlerT extends BaseProxyHandlerT
 +implements MethodInterceptor {
 +
 +private final UsageTrackingT usageTracking;
 +
 +CglibProxyHandler(T pooledObject, UsageTrackingT usageTracking) {
 +super(pooledObject);
 +this.usageTracking = usageTracking;
 +}
 +
 +@Override
 +public Object intercept(Object object, Method method, Object[] args,
 +MethodProxy methodProxy) throws Throwable {
 +validateProxiedObject();
 +T pooledObject = getPooledObject();
 +if (usageTracking != null) {
 +usageTracking.use(pooledObject);
 +}
 +
 +return method.invoke(pooledObject, args);
 +}
 +}

 Propchange: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
 --
 svn:eol-style = native

 Added: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java?rev=1531846view=auto
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java
  (added)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java
  Mon Oct 14 10:50:28 2013
 @@ -0,0 +1,57 @@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the License); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *  http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an AS IS BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.commons.pool2.proxy;
 +
 +import

Re: svn commit: r1531846 - in /commons/proper/pool/trunk: ./ src/main/java/org/apache/commons/pool2/proxy/ src/test/java/org/apache/commons/pool2/proxy/

2013-10-14 Thread sebb
On 14 October 2013 11:50,  ma...@apache.org wrote:
 Author: markt
 Date: Mon Oct 14 10:50:28 2013
 New Revision: 1531846

 URL: http://svn.apache.org/r1531846
 Log:
 Add CGLib proxy implementation and test.

 Added:
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
(with props)
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxySource.java
(with props)
 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/proxy/TestProxiedObjectPoolWithCglibProxy.java
(with props)
 Modified:
 commons/proper/pool/trunk/pom.xml

 Modified: commons/proper/pool/trunk/pom.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1531846r1=1531845r2=1531846view=diff
 ==
 --- commons/proper/pool/trunk/pom.xml (original)
 +++ commons/proper/pool/trunk/pom.xml Mon Oct 14 10:50:28 2013
 @@ -120,6 +120,19 @@
version4.11/version
scopetest/scope
  /dependency
 +dependency
 +  groupIdcglib/groupId
 +  artifactIdcglib/artifactId
 +  version3.0/version
 +  scopeprovided/scope
 +/dependency
 +dependency
 +  groupIdorg.ow2.asm/groupId
 +  artifactIdasm-util/artifactId
 +  version4.0/version
 +  scopeprovided/scope
 +/dependency
 +
/dependencies

distributionManagement

 Added: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java?rev=1531846view=auto
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
  (added)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
  Mon Oct 14 10:50:28 2013

AL header ?

 @@ -0,0 +1,32 @@
 +package org.apache.commons.pool2.proxy;
 +



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



Re: svn commit: r1531846 - in /commons/proper/pool/trunk: ./ src/main/java/org/apache/commons/pool2/proxy/ src/test/java/org/apache/commons/pool2/proxy/

2013-10-14 Thread Mark Thomas
On 14/10/2013 17:59, sebb wrote:
 Added: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java?rev=1531846view=auto
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
  (added)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/proxy/CglibProxyHandler.java
  Mon Oct 14 10:50:28 2013
 
 AL header ?

Yep, missing. Fixed.

Mark


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



Re: svn commit: r1532083 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

2013-10-14 Thread Phil Steitz
On 10/14/13 1:42 PM, ma...@apache.org wrote:
 Author: markt
 Date: Mon Oct 14 20:42:03 2013
 New Revision: 1532083

 URL: http://svn.apache.org/r1532083
 Log:
 Fix some FindBugs warnings

 Modified:
 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1532083r1=1532082r2=1532083view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  Mon Oct 14 20:42:03 2013
 @@ -60,10 +60,10 @@ public class TestGenericKeyedObjectPool 
  protected KeyedObjectPoolObject,Object makeEmptyPool(int mincapacity) {
  
  KeyedPooledObjectFactoryObject,Object factory =
 -new KeyedPooledObjectFactoryObject,Object()  {
 +new BaseKeyedPooledObjectFactoryObject,Object()  {

One day, if someone wants to do a public service and seize a great
opportunity to jump into [pool], s/he will fix the cheezy Object,
Object setup in these tests and actually generify the test
factories here. :)

Phil
  ConcurrentHashMapObject,AtomicInteger map = new 
 ConcurrentHashMapObject,AtomicInteger();
  @Override
 -public PooledObjectObject makeObject(Object key) {
 +public Object create(Object key) throws Exception {
  int counter = 0;
  AtomicInteger Counter = map.get(key);
  if(null != Counter) {
 @@ -72,16 +72,8 @@ public class TestGenericKeyedObjectPool 
  map.put(key, new AtomicInteger(0));
  counter = 0;
  }
 -return new DefaultPooledObjectObject(String.valueOf(key) + 
 String.valueOf(counter));
 +return String.valueOf(key) + String.valueOf(counter);
  }
 -@Override
 -public void destroyObject(Object key, PooledObjectObject obj) 
 { }
 -@Override
 -public boolean validateObject(Object key, PooledObjectObject 
 obj) { return true; }
 -@Override
 -public void activateObject(Object key,PooledObjectObject obj) 
 { }
 -@Override
 -public void passivateObject(Object key, PooledObjectObject 
 obj) { }
  };
  
  GenericKeyedObjectPoolObject,Object pool =
 @@ -110,9 +102,9 @@ public class TestGenericKeyedObjectPool 
  
  private GenericKeyedObjectPoolString,String pool = null;
  private SimpleFactoryString factory = null;
 -private final Integer zero = new Integer(0);
 -private final Integer one = new Integer(1);
 -private final Integer two = new Integer(2);
 +private static final Integer KEY_ZERO = Integer.valueOf(0);
 +private static final Integer KEY_ONE = Integer.valueOf(1);
 +private static final Integer KEY_TWO = Integer.valueOf(2);
  
  @Before
  public void setUp() throws Exception {
 @@ -750,7 +742,7 @@ public class TestGenericKeyedObjectPool 
  pool.setLifo(lifo);
  
  for (int i = 0; i  3; i ++) {
 -Integer key = new Integer(i);
 +Integer key = Integer.valueOf(i);
  for (int j = 0; j  5; j++) {
  pool.addObject(key);
  }
 @@ -768,41 +760,41 @@ public class TestGenericKeyedObjectPool 
   */
  
  pool.evict(); // Kill (0,0),(0,1)
 -assertEquals(3, pool.getNumIdle(zero));
 -String objZeroA = pool.borrowObject(zero);
 +assertEquals(3, pool.getNumIdle(KEY_ZERO));
 +String objZeroA = pool.borrowObject(KEY_ZERO);
  assertTrue(lifo ? objZeroA.equals(04) : objZeroA.equals(02));
 -assertEquals(2, pool.getNumIdle(zero));
 -String objZeroB = pool.borrowObject(zero);
 +assertEquals(2, pool.getNumIdle(KEY_ZERO));
 +String objZeroB = pool.borrowObject(KEY_ZERO);
  assertTrue(objZeroB.equals(03));
 -assertEquals(1, pool.getNumIdle(zero));
 +assertEquals(1, pool.getNumIdle(KEY_ZERO));
  
  pool.evict(); // Kill remaining 0 survivor and (1,5)
 -assertEquals(0, pool.getNumIdle(zero));
 -assertEquals(4, pool.getNumIdle(one));
 -String objOneA = pool.borrowObject(one);
 +assertEquals(0, pool.getNumIdle(KEY_ZERO));
 +assertEquals(4, pool.getNumIdle(KEY_ONE));
 +String objOneA = pool.borrowObject(KEY_ONE);
  assertTrue(lifo ? objOneA.equals(19) : objOneA.equals(16));
 -assertEquals(3, pool.getNumIdle(one));
 -String objOneB = pool.borrowObject(one

Re: svn commit: r1512140 [1/2] - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/commons/pool2/ test/java/org/apach

2013-08-08 Thread Phil Steitz
On 8/8/13 10:20 PM, pste...@apache.org wrote:
 Author: psteitz
 Date: Fri Aug  9 05:20:37 2013
 New Revision: 1512140

 URL: http://svn.apache.org/r1512140
 Log:
 Eliminated PoolableObjectFactory, KeyedPoolableObjectFactory and replaced 
 them with PooledObjectFactory, KeyedPooledObjectFactory, the (formerly) 
 subclasses that create and operate on PooledObjects.  Similarly replaced the 
 base factories with PooledObject versions.  Modified SoftReferenceObjectPool 
 to manage PooledObjects.


Thanks in advance for careful review - especially
SoftReferenceObjectPool changes.  I tried to preserve the original
semantics of the class, but I am honestly not sure that is needed /
best.  In particular, the original version always cleared references
to objects when they were checked out.  To be able to track objects
via soft references, I needed to create new (unregistered)
references to the objects being checked out and make the
PooledSoftReferences mutable.  I am not sure this is necessary -
i.e., we could just leave the queued references in allReferences. 
If a client is holding a hard reference to an object, a soft
reference to it should not get queued, so I don't see why we need to
explicitly prevent it.  I also did not fix the over-synchronization
and violation of our invariant that factory methods are not called
in sync scope in that class.  One thing I did change is I added a
check similar to what GOP has for an object belonging to the pool on
return.  This will hurl on objects whose references have been
cleared, but unless I am missing something, this is not really a
logical possibility.  I am no expert on GC, so it is quite possible
I have this wrong, so please enlighten me if I do.   Finally, I did
not add JMX instrumentation.  I would be OK holding on all of these
to 2.1, but will work on the JMX stuff next.  All DBCP tests pass
with no change to the code in trunk other than dropping the unused
imports.

Phil

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



Re: [pool] 2.0 factory interfaces WAS: Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/

2013-08-07 Thread Phil Steitz
On 8/4/13 9:27 AM, Phil Steitz wrote:
 On 8/4/13 7:24 AM, Mark Thomas wrote:
 On 03/08/2013 17:15, Phil Steitz wrote:
 On 7/30/13 9:16 AM, Phil Steitz wrote:
 I have started working on this.  Should have something to commit at
 least for GOP in the next day or two.
 I am stuck on SoftReferenceObectPool. 
 :(

 I have been able to handle
 everything else collapsing down to just Pooled(Keyed)ObjectFactory /
 Base(Keyed)ObjectPool.
 Excellent.

 To stick with (and get factory / monitoring
 benefits of) PooledObjectFactory / PooledObjects, I need to create a
 version of DefaultPooledObject that wraps SoftReferences and these
 have to be mutable - i.e., when an instance is returned a new soft
 reference is created and stored in the pool, but we want to maintain
 PooledObject state.  To do this, I need to be able to recognize the
 returning object.  I could do this by searching the pool, but that
 will cost something.  On the other hand, the lack of search now
 means returnObject is not idempotent (like it is in the rest of the
 2.0 pools).  Multiple returns will put multiple soft references to
 the same object in the pool.

 So, I would appreciate some feedback on the following options:

 1) Add a search for the returning object and create a
 PooledSoftReference subclass of DefaultPooledObject within
 SoftReferencePool to be stored in the pool.

 2) Keep PoolableObjectFactory just for this pool and leave it alone,
 adding a warning to returnObject (not a new issue, just different
 from other 2.0 pools).
 I think the benefits of the monitoring justify adding the search so my
 preference is for option 1.
 Drat, I thought I was going to get away with 2) - he he.  I will
 plow ahead with 1 :)

OK, done now.  All tests pass.  I am just cleaning up javadoc and
will commit in next 24 hours.  I have not added JMX stuff to
SoftReferenceObjectPool, but will do that after committing the
initial refactoring.  I also did not clean up the complete sync and
spurious notifies in SoftReferenceObjectPool.  That can also be
looked at next.  More observations on this class to follow post-commit.

Phil

 Phil
 Mark


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




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



Re: [pool] 2.0 factory interfaces WAS: Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/

2013-08-04 Thread Phil Steitz
On 8/4/13 7:24 AM, Mark Thomas wrote:
 On 03/08/2013 17:15, Phil Steitz wrote:
 On 7/30/13 9:16 AM, Phil Steitz wrote:
 I have started working on this.  Should have something to commit at
 least for GOP in the next day or two.
 I am stuck on SoftReferenceObectPool. 
 :(

 I have been able to handle
 everything else collapsing down to just Pooled(Keyed)ObjectFactory /
 Base(Keyed)ObjectPool.
 Excellent.

 To stick with (and get factory / monitoring
 benefits of) PooledObjectFactory / PooledObjects, I need to create a
 version of DefaultPooledObject that wraps SoftReferences and these
 have to be mutable - i.e., when an instance is returned a new soft
 reference is created and stored in the pool, but we want to maintain
 PooledObject state.  To do this, I need to be able to recognize the
 returning object.  I could do this by searching the pool, but that
 will cost something.  On the other hand, the lack of search now
 means returnObject is not idempotent (like it is in the rest of the
 2.0 pools).  Multiple returns will put multiple soft references to
 the same object in the pool.

 So, I would appreciate some feedback on the following options:

 1) Add a search for the returning object and create a
 PooledSoftReference subclass of DefaultPooledObject within
 SoftReferencePool to be stored in the pool.

 2) Keep PoolableObjectFactory just for this pool and leave it alone,
 adding a warning to returnObject (not a new issue, just different
 from other 2.0 pools).
 I think the benefits of the monitoring justify adding the search so my
 preference is for option 1.

Drat, I thought I was going to get away with 2) - he he.  I will
plow ahead with 1 :)

Phil

 Mark


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




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



Re: [pool] 2.0 factory interfaces WAS: Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/

2013-08-03 Thread Phil Steitz
On 7/30/13 9:16 AM, Phil Steitz wrote:
 I have started working on this.  Should have something to commit at
 least for GOP in the next day or two.

I am stuck on SoftReferenceObectPool.  I have been able to handle
everything else collapsing down to just Pooled(Keyed)ObjectFactory /
Base(Keyed)ObjectPool.  To stick with (and get factory / monitoring
benefits of) PooledObjectFactory / PooledObjects, I need to create a
version of DefaultPooledObject that wraps SoftReferences and these
have to be mutable - i.e., when an instance is returned a new soft
reference is created and stored in the pool, but we want to maintain
PooledObject state.  To do this, I need to be able to recognize the
returning object.  I could do this by searching the pool, but that
will cost something.  On the other hand, the lack of search now
means returnObject is not idempotent (like it is in the rest of the
2.0 pools).  Multiple returns will put multiple soft references to
the same object in the pool.

So, I would appreciate some feedback on the following options:

1) Add a search for the returning object and create a
PooledSoftReference subclass of DefaultPooledObject within
SoftReferencePool to be stored in the pool.

2) Keep PoolableObjectFactory just for this pool and leave it alone,
adding a warning to returnObject (not a new issue, just different
from other 2.0 pools).

Phil

 Phil

 On 7/29/13 10:56 AM, Phil Steitz wrote:
 On 7/24/13 1:06 PM, Mark Thomas wrote:
 On 24/07/2013 21:01, ma...@apache.org wrote:
 Author: markt
 Date: Wed Jul 24 20:01:34 2013
 New Revision: 1506685

 URL: http://svn.apache.org/r1506685
 Log:
 Create two new factory interfaces that work with PooledObject instances 
 rather than Object instances and switch Gop and GKOP to use them.
 One area I'd particularly like some comment on is PooledObject 
 PooledObjectImpl.

 I considered just having a single PooledObject implementation class in
 o.a.c.pool2 but decided that as implementation it belonged in
 o.a.c.pool2.impl. That lead to needing PoolImplUtils.

 I'm not completely happy with the current arrangement but neither have a
 found a better one. Thoughts?
 I wonder if we really want / need to retain the original dumb (not
 in the sense of bad design, but no tracking) pooling infrastructure
 from 1.x.  Thinking about making it easy for users to grokk the
 setup and get a GOP or GKOP working, I wonder if it might be better
 to drop the base classes and just start with simple, refactored pool
 and factory interfaces that create and manage PooledObjects
 directly.  Users will still only absolutely *have* to implement
 makeObject in their factories and the default code will take care of
 everything else.  So you just end up with PoolableObjectFactories
 sourcing and managing PooledObjects.  GOP, GKOP still return
 unwrapped objects via borrow and there is an
 AbstractPoolableObjectFactory with makeObject abstract and the rest
 provided.  I have not played with this yet (hopefully will have some
 time in the next couple of days), but I wonder if it might not be
 better / simpler.  Also, adding methods to GOP, GKOP that return
 PooledObject instances (maybe stripped down) might be useful to
 clients.  Sorry if above is naive / old ground.  I just want to make
 sure what we end up with is a simple as possible.

 Phil
 Mark

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




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



Re: [pool] 2.0 factory interfaces WAS: Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/

2013-07-30 Thread Phil Steitz
I have started working on this.  Should have something to commit at
least for GOP in the next day or two.

Phil

On 7/29/13 10:56 AM, Phil Steitz wrote:
 On 7/24/13 1:06 PM, Mark Thomas wrote:
 On 24/07/2013 21:01, ma...@apache.org wrote:
 Author: markt
 Date: Wed Jul 24 20:01:34 2013
 New Revision: 1506685

 URL: http://svn.apache.org/r1506685
 Log:
 Create two new factory interfaces that work with PooledObject instances 
 rather than Object instances and switch Gop and GKOP to use them.
 One area I'd particularly like some comment on is PooledObject 
 PooledObjectImpl.

 I considered just having a single PooledObject implementation class in
 o.a.c.pool2 but decided that as implementation it belonged in
 o.a.c.pool2.impl. That lead to needing PoolImplUtils.

 I'm not completely happy with the current arrangement but neither have a
 found a better one. Thoughts?
 I wonder if we really want / need to retain the original dumb (not
 in the sense of bad design, but no tracking) pooling infrastructure
 from 1.x.  Thinking about making it easy for users to grokk the
 setup and get a GOP or GKOP working, I wonder if it might be better
 to drop the base classes and just start with simple, refactored pool
 and factory interfaces that create and manage PooledObjects
 directly.  Users will still only absolutely *have* to implement
 makeObject in their factories and the default code will take care of
 everything else.  So you just end up with PoolableObjectFactories
 sourcing and managing PooledObjects.  GOP, GKOP still return
 unwrapped objects via borrow and there is an
 AbstractPoolableObjectFactory with makeObject abstract and the rest
 provided.  I have not played with this yet (hopefully will have some
 time in the next couple of days), but I wonder if it might not be
 better / simpler.  Also, adding methods to GOP, GKOP that return
 PooledObject instances (maybe stripped down) might be useful to
 clients.  Sorry if above is naive / old ground.  I just want to make
 sure what we end up with is a simple as possible.

 Phil
 Mark

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




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



[pool] 2.0 factory interfaces WAS: Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/comm

2013-07-29 Thread Phil Steitz
On 7/24/13 1:06 PM, Mark Thomas wrote:
 On 24/07/2013 21:01, ma...@apache.org wrote:
 Author: markt
 Date: Wed Jul 24 20:01:34 2013
 New Revision: 1506685

 URL: http://svn.apache.org/r1506685
 Log:
 Create two new factory interfaces that work with PooledObject instances 
 rather than Object instances and switch Gop and GKOP to use them.
 One area I'd particularly like some comment on is PooledObject 
 PooledObjectImpl.

 I considered just having a single PooledObject implementation class in
 o.a.c.pool2 but decided that as implementation it belonged in
 o.a.c.pool2.impl. That lead to needing PoolImplUtils.

 I'm not completely happy with the current arrangement but neither have a
 found a better one. Thoughts?

I wonder if we really want / need to retain the original dumb (not
in the sense of bad design, but no tracking) pooling infrastructure
from 1.x.  Thinking about making it easy for users to grokk the
setup and get a GOP or GKOP working, I wonder if it might be better
to drop the base classes and just start with simple, refactored pool
and factory interfaces that create and manage PooledObjects
directly.  Users will still only absolutely *have* to implement
makeObject in their factories and the default code will take care of
everything else.  So you just end up with PoolableObjectFactories
sourcing and managing PooledObjects.  GOP, GKOP still return
unwrapped objects via borrow and there is an
AbstractPoolableObjectFactory with makeObject abstract and the rest
provided.  I have not played with this yet (hopefully will have some
time in the next couple of days), but I wonder if it might not be
better / simpler.  Also, adding methods to GOP, GKOP that return
PooledObject instances (maybe stripped down) might be useful to
clients.  Sorry if above is naive / old ground.  I just want to make
sure what we end up with is a simple as possible.

Phil

 Mark

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




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



Re: [pool] 2.0 factory interfaces WAS: Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/

2013-07-29 Thread Mark Thomas
On 29/07/2013 19:56, Phil Steitz wrote:
 On 7/24/13 1:06 PM, Mark Thomas wrote:
 On 24/07/2013 21:01, ma...@apache.org wrote:
 Author: markt
 Date: Wed Jul 24 20:01:34 2013
 New Revision: 1506685

 URL: http://svn.apache.org/r1506685
 Log:
 Create two new factory interfaces that work with PooledObject instances 
 rather than Object instances and switch Gop and GKOP to use them.
 One area I'd particularly like some comment on is PooledObject 
 PooledObjectImpl.

 I considered just having a single PooledObject implementation class in
 o.a.c.pool2 but decided that as implementation it belonged in
 o.a.c.pool2.impl. That lead to needing PoolImplUtils.

 I'm not completely happy with the current arrangement but neither have a
 found a better one. Thoughts?
 
 I wonder if we really want / need to retain the original dumb (not
 in the sense of bad design, but no tracking) pooling infrastructure
 from 1.x.  Thinking about making it easy for users to grokk the
 setup and get a GOP or GKOP working, I wonder if it might be better
 to drop the base classes and just start with simple, refactored pool
 and factory interfaces that create and manage PooledObjects
 directly.  Users will still only absolutely *have* to implement
 makeObject in their factories and the default code will take care of
 everything else.  So you just end up with PoolableObjectFactories
 sourcing and managing PooledObjects.  GOP, GKOP still return
 unwrapped objects via borrow and there is an
 AbstractPoolableObjectFactory with makeObject abstract and the rest
 provided.  I have not played with this yet (hopefully will have some
 time in the next couple of days), but I wonder if it might not be
 better / simpler.  Also, adding methods to GOP, GKOP that return
 PooledObject instances (maybe stripped down) might be useful to
 clients.  Sorry if above is naive / old ground.  I just want to make
 sure what we end up with is a simple as possible.

That is certainly do-able. The question is what does it mean for the
various implementations like SoftReferenceObjectPool and those provided
by PoolUtils.

If there are implementations there are are no longer required or
rendered obsolete by the Pool2 impl then a big +1 from me to removing them.

Mark


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



Re: [pool] 2.0 factory interfaces WAS: Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/

2013-07-29 Thread Phil Steitz
On 7/29/13 11:11 AM, Mark Thomas wrote:
 On 29/07/2013 19:56, Phil Steitz wrote:
 On 7/24/13 1:06 PM, Mark Thomas wrote:
 On 24/07/2013 21:01, ma...@apache.org wrote:
 Author: markt
 Date: Wed Jul 24 20:01:34 2013
 New Revision: 1506685

 URL: http://svn.apache.org/r1506685
 Log:
 Create two new factory interfaces that work with PooledObject instances 
 rather than Object instances and switch Gop and GKOP to use them.
 One area I'd particularly like some comment on is PooledObject 
 PooledObjectImpl.

 I considered just having a single PooledObject implementation class in
 o.a.c.pool2 but decided that as implementation it belonged in
 o.a.c.pool2.impl. That lead to needing PoolImplUtils.

 I'm not completely happy with the current arrangement but neither have a
 found a better one. Thoughts?
 I wonder if we really want / need to retain the original dumb (not
 in the sense of bad design, but no tracking) pooling infrastructure
 from 1.x.  Thinking about making it easy for users to grokk the
 setup and get a GOP or GKOP working, I wonder if it might be better
 to drop the base classes and just start with simple, refactored pool
 and factory interfaces that create and manage PooledObjects
 directly.  Users will still only absolutely *have* to implement
 makeObject in their factories and the default code will take care of
 everything else.  So you just end up with PoolableObjectFactories
 sourcing and managing PooledObjects.  GOP, GKOP still return
 unwrapped objects via borrow and there is an
 AbstractPoolableObjectFactory with makeObject abstract and the rest
 provided.  I have not played with this yet (hopefully will have some
 time in the next couple of days), but I wonder if it might not be
 better / simpler.  Also, adding methods to GOP, GKOP that return
 PooledObject instances (maybe stripped down) might be useful to
 clients.  Sorry if above is naive / old ground.  I just want to make
 sure what we end up with is a simple as possible.
 That is certainly do-able. The question is what does it mean for the
 various implementations like SoftReferenceObjectPool and those provided
 by PoolUtils.

 If there are implementations there are are no longer required or
 rendered obsolete by the Pool2 impl then a big +1 from me to removing them.

No reason the ones we keep could not be modified to use the new
setup.  I have not taken a close look at all of the aminals in the
PoolUtils zoo recently, but I bet a lot of them are obsolete in the
2.0 world.

Phil

 Mark


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




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



Re: [pool] 2.0 factory interfaces WAS: Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/c

2013-07-29 Thread Gary Gregory
On Mon, Jul 29, 2013 at 1:56 PM, Phil Steitz phil.ste...@gmail.com wrote:

 On 7/24/13 1:06 PM, Mark Thomas wrote:
  On 24/07/2013 21:01, ma...@apache.org wrote:
  Author: markt
  Date: Wed Jul 24 20:01:34 2013
  New Revision: 1506685
 
  URL: http://svn.apache.org/r1506685
  Log:
  Create two new factory interfaces that work with PooledObject instances
 rather than Object instances and switch Gop and GKOP to use them.
  One area I'd particularly like some comment on is PooledObject 
  PooledObjectImpl.
 
  I considered just having a single PooledObject implementation class in
  o.a.c.pool2 but decided that as implementation it belonged in
  o.a.c.pool2.impl. That lead to needing PoolImplUtils.
 
  I'm not completely happy with the current arrangement but neither have a
  found a better one. Thoughts?

 I wonder if we really want / need to retain the original dumb (not
 in the sense of bad design, but no tracking) pooling infrastructure
 from 1.x.  Thinking about making it easy for users to grokk the
 setup and get a GOP or GKOP working, I wonder if it might be better
 to drop the base classes and just start with simple, refactored pool
 and factory interfaces that create and manage PooledObjects
 directly.  Users will still only absolutely *have* to implement
 makeObject in their factories and the default code will take care of
 everything else.  So you just end up with PoolableObjectFactories
 sourcing and managing PooledObjects.  GOP, GKOP still return
 unwrapped objects via borrow and there is an
 AbstractPoolableObjectFactory with makeObject abstract and the rest
 provided.  I have not played with this yet (hopefully will have some
 time in the next couple of days), but I wonder if it might not be
 better / simpler.  Also, adding methods to GOP, GKOP that return
 PooledObject instances (maybe stripped down) might be useful to
 clients.  Sorry if above is naive / old ground.  I just want to make
 sure what we end up with is a simple as possible.


This all sounds good at first glance.

The less code I, as a user, have to understand and write, the better.

If that takes care of 80% of user stories, great. For the rest, we can add
bells and whistles, on top of what will likely be a simpler and cleaner
base.

Gary


 Phil
 
  Mark
 
  -
  To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
  For additional commands, e-mail: dev-h...@commons.apache.org
 
 


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




-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Editionhttp://www.manning.com/bauer3/
JUnit in Action, Second Edition http://www.manning.com/tahchiev/
Spring Batch in Action http://www.manning.com/templier/
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: [pool] 2.0 factory interfaces WAS: Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/c

2013-07-29 Thread James Carman
I like the sound of that!


On Mon, Jul 29, 2013 at 2:42 PM, Gary Gregory garydgreg...@gmail.com wrote:
 On Mon, Jul 29, 2013 at 1:56 PM, Phil Steitz phil.ste...@gmail.com wrote:

 On 7/24/13 1:06 PM, Mark Thomas wrote:
  On 24/07/2013 21:01, ma...@apache.org wrote:
  Author: markt
  Date: Wed Jul 24 20:01:34 2013
  New Revision: 1506685
 
  URL: http://svn.apache.org/r1506685
  Log:
  Create two new factory interfaces that work with PooledObject instances
 rather than Object instances and switch Gop and GKOP to use them.
  One area I'd particularly like some comment on is PooledObject 
  PooledObjectImpl.
 
  I considered just having a single PooledObject implementation class in
  o.a.c.pool2 but decided that as implementation it belonged in
  o.a.c.pool2.impl. That lead to needing PoolImplUtils.
 
  I'm not completely happy with the current arrangement but neither have a
  found a better one. Thoughts?

 I wonder if we really want / need to retain the original dumb (not
 in the sense of bad design, but no tracking) pooling infrastructure
 from 1.x.  Thinking about making it easy for users to grokk the
 setup and get a GOP or GKOP working, I wonder if it might be better
 to drop the base classes and just start with simple, refactored pool
 and factory interfaces that create and manage PooledObjects
 directly.  Users will still only absolutely *have* to implement
 makeObject in their factories and the default code will take care of
 everything else.  So you just end up with PoolableObjectFactories
 sourcing and managing PooledObjects.  GOP, GKOP still return
 unwrapped objects via borrow and there is an
 AbstractPoolableObjectFactory with makeObject abstract and the rest
 provided.  I have not played with this yet (hopefully will have some
 time in the next couple of days), but I wonder if it might not be
 better / simpler.  Also, adding methods to GOP, GKOP that return
 PooledObject instances (maybe stripped down) might be useful to
 clients.  Sorry if above is naive / old ground.  I just want to make
 sure what we end up with is a simple as possible.


 This all sounds good at first glance.

 The less code I, as a user, have to understand and write, the better.

 If that takes care of 80% of user stories, great. For the rest, we can add
 bells and whistles, on top of what will likely be a simpler and cleaner
 base.

 Gary


 Phil
 
  Mark
 
  -
  To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
  For additional commands, e-mail: dev-h...@commons.apache.org
 
 


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




 --
 E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
 Java Persistence with Hibernate, Second 
 Editionhttp://www.manning.com/bauer3/
 JUnit in Action, Second Edition http://www.manning.com/tahchiev/
 Spring Batch in Action http://www.manning.com/templier/
 Blog: http://garygregory.wordpress.com
 Home: http://garygregory.com/
 Tweet! http://twitter.com/GaryGregory

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



Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/commons/pool2/ test/java/org/apache/comm

2013-07-25 Thread Benedikt Ritter
How about DefaultPooledObject? I like the Default* prefix more than the
*Impl postfix.

Benedikt


2013/7/24 Mark Thomas ma...@apache.org

 On 24/07/2013 21:01, ma...@apache.org wrote:
  Author: markt
  Date: Wed Jul 24 20:01:34 2013
  New Revision: 1506685
 
  URL: http://svn.apache.org/r1506685
  Log:
  Create two new factory interfaces that work with PooledObject instances
 rather than Object instances and switch Gop and GKOP to use them.

 One area I'd particularly like some comment on is PooledObject 
 PooledObjectImpl.

 I considered just having a single PooledObject implementation class in
 o.a.c.pool2 but decided that as implementation it belonged in
 o.a.c.pool2.impl. That lead to needing PoolImplUtils.

 I'm not completely happy with the current arrangement but neither have a
 found a better one. Thoughts?

 Mark

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




-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter


Re: svn commit: r1506954 - in /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2: ./ impl/

2013-07-25 Thread sebb
On 25 July 2013 14:10,  ma...@apache.org wrote:
 Author: markt
 Date: Thu Jul 25 13:10:04 2013
 New Revision: 1506954

 URL: http://svn.apache.org/r1506954
 Log:
 DBCP-229
 Make stack trace of borrowing available to help ID leaks.
 This change makes some information available about objects in the pool 
 (borrowed and idle) via JMX. More information can be exposed if required.

 Added:
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/DefaultPooledObjectInfo.java
(with props)
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/DefaultPooledObjectInfoMBean.java
(with props)

AL headers?

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



Re: svn commit: r1506916 - in /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl: DefaultPooledObject.java GenericKeyedObjectPool.java GenericObjectPool.java PoolImplUtils.java Poo

2013-07-25 Thread sebb
On 25 July 2013 12:56,  ma...@apache.org wrote:
 Author: markt
 Date: Thu Jul 25 11:56:41 2013
 New Revision: 1506916

 URL: http://svn.apache.org/r1506916
 Log:
 Change name of implementation class

from? to?

Yes, this can be derived from the history, but it would be easier to
read the log if a few more details were provided please.

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



Re: svn commit: r1506916 - in /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl: DefaultPooledObject.java GenericKeyedObjectPool.java GenericObjectPool.java PoolImplUtils.java Poo

2013-07-25 Thread Matt Benson
In this case, since the very fact that there was an
interface/implementation dichotomy was a brand new thing, does it really
matter?

Matt


On Thu, Jul 25, 2013 at 9:57 AM, sebb seb...@gmail.com wrote:

 On 25 July 2013 12:56,  ma...@apache.org wrote:
  Author: markt
  Date: Thu Jul 25 11:56:41 2013
  New Revision: 1506916
 
  URL: http://svn.apache.org/r1506916
  Log:
  Change name of implementation class

 from? to?

 Yes, this can be derived from the history, but it would be easier to
 read the log if a few more details were provided please.

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




Re: svn commit: r1506954 - in /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2: ./ impl/

2013-07-25 Thread Mark Thomas
On 25/07/2013 15:53, sebb wrote:
 On 25 July 2013 14:10,  ma...@apache.org wrote:
 Author: markt
 Date: Thu Jul 25 13:10:04 2013
 New Revision: 1506954

 URL: http://svn.apache.org/r1506954
 Log:
 DBCP-229
 Make stack trace of borrowing available to help ID leaks.
 This change makes some information available about objects in the pool 
 (borrowed and idle) via JMX. More information can be exposed if required.

 Added:
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/DefaultPooledObjectInfo.java
(with props)
 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/DefaultPooledObjectInfoMBean.java
(with props)
 
 AL headers?

Sorry. I was trying lots of different things and was leaving things like
headers out as I was creating and deleting a lot of classes. I meant to
put them in the final version and forgot. I'll do that now.

Mark


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



Re: svn commit: r1506916 - in /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl: DefaultPooledObject.java GenericKeyedObjectPool.java GenericObjectPool.java PoolImplUtils.java Poo

2013-07-25 Thread sebb
On 25 July 2013 16:09, Matt Benson gudnabr...@gmail.com wrote:
 In this case, since the very fact that there was an
 interface/implementation dichotomy was a brand new thing, does it really
 matter?

If the SVN history is to be useful, it should ideally be readable
without needing all the context.
i.e. when someone is reviewing the SVN history it won't be obvious
that the change is new.

I see the log message as performing two main functions:
- documenting why the commit was performed, so readers of the commit
message can determine if the change looks good
- providing a quick way to navigate changes without needing to do
perform diffs between versions.

Obviously it's not a huge deal - in theory since the ASF releases
source (and not SVN history) all SVN log messages are irrelevant - but
it does help current developers and future maintainers if the log
messages describe the commit accurately.

 Matt


 On Thu, Jul 25, 2013 at 9:57 AM, sebb seb...@gmail.com wrote:

 On 25 July 2013 12:56,  ma...@apache.org wrote:
  Author: markt
  Date: Thu Jul 25 11:56:41 2013
  New Revision: 1506916
 
  URL: http://svn.apache.org/r1506916
  Log:
  Change name of implementation class

 from? to?

 Yes, this can be derived from the history, but it would be easier to
 read the log if a few more details were provided please.

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



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



Re: svn commit: r1506488 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/commons/pool2/impl/

2013-07-24 Thread Mark Thomas
On 24/07/2013 11:37, ma...@apache.org wrote:
 Author: markt
 Date: Wed Jul 24 10:37:09 2013
 New Revision: 1506488
 
 URL: http://svn.apache.org/r1506488
 Log:
 Make PooledObject an interface so it can be used in the Factory 
 implementations.

In case anyone is wondering where I am heading with this, this is a step
towards fixing DBCP-156.

By making the pooled object available to the factory, the factory can
implement a validation rule along the lines of no object older than x
hours. That particular rule could be implemented by the factory keeping
track of every object and its creation time but since the PooledObject
already has the information I think it makes sense to re-use it and keep
all the pooled object state information in one place. It also allows for
more complex state based validation rules.

Mark

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



Re: svn commit: r1506488 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/commons/pool2/impl/

2013-07-24 Thread Phil Steitz
On 7/24/13 3:41 AM, Mark Thomas wrote:
 On 24/07/2013 11:37, ma...@apache.org wrote:
 Author: markt
 Date: Wed Jul 24 10:37:09 2013
 New Revision: 1506488

 URL: http://svn.apache.org/r1506488
 Log:
 Make PooledObject an interface so it can be used in the Factory 
 implementations.
 In case anyone is wondering where I am heading with this, this is a step
 towards fixing DBCP-156.

 By making the pooled object available to the factory, the factory can
 implement a validation rule along the lines of no object older than x
 hours. That particular rule could be implemented by the factory keeping
 track of every object and its creation time but since the PooledObject
 already has the information I think it makes sense to re-use it and keep
 all the pooled object state information in one place. It also allows for
 more complex state based validation rules.

Big +1 here.   Thanks!

Phil

 Mark

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




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



Re: svn commit: r1506685 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/ main/java/org/apache/commons/pool2/impl/ test/java/org/apache/commons/pool2/ test/java/org/apache/comm

2013-07-24 Thread Mark Thomas
On 24/07/2013 21:01, ma...@apache.org wrote:
 Author: markt
 Date: Wed Jul 24 20:01:34 2013
 New Revision: 1506685
 
 URL: http://svn.apache.org/r1506685
 Log:
 Create two new factory interfaces that work with PooledObject instances 
 rather than Object instances and switch Gop and GKOP to use them.

One area I'd particularly like some comment on is PooledObject 
PooledObjectImpl.

I considered just having a single PooledObject implementation class in
o.a.c.pool2 but decided that as implementation it belonged in
o.a.c.pool2.impl. That lead to needing PoolImplUtils.

I'm not completely happy with the current arrangement but neither have a
found a better one. Thoughts?

Mark

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



Re: svn commit: r1451347 - /commons/proper/pool/trunk/pom.xml

2013-03-03 Thread sebb
On 28 February 2013 21:12,  joc...@apache.org wrote:
 Author: jochen
 Date: Thu Feb 28 21:12:53 2013
 New Revision: 1451347

 URL: http://svn.apache.org/r1451347
 Log:
 Removed groupId, as it is redundant.

-1

I thought we decided it was safer to be specific about the groupId.

Otherwise it's not clear whether the Id is accidentally omitted.

 Modified:
 commons/proper/pool/trunk/pom.xml

 Modified: commons/proper/pool/trunk/pom.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1451347r1=1451346r2=1451347view=diff
 ==
 --- commons/proper/pool/trunk/pom.xml (original)
 +++ commons/proper/pool/trunk/pom.xml Thu Feb 28 21:12:53 2013
 @@ -25,7 +25,6 @@
  version28/version
/parent
modelVersion4.0.0/modelVersion
 -  groupIdorg.apache.commons/groupId
artifactIdcommons-pool2/artifactId
version2.0-SNAPSHOT/version
nameCommons Pool/name



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



Re: svn commit: r1426799 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/impl/ test/java/org/apache/commons/pool2/impl/

2013-01-10 Thread Gary Gregory
Should this be ported to the 1.6 branch?

Gary


On Sat, Dec 29, 2012 at 1:23 PM, pste...@apache.org wrote:

 Author: psteitz
 Date: Sat Dec 29 18:23:33 2012
 New Revision: 1426799

 URL: http://svn.apache.org/viewvc?rev=1426799view=rev
 Log:
 Fixed threadsafety problem in GOP, GKOP invalidateObject. JIRA: POOL-231.

 Modified:

 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java

 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java

 Modified:
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1426799r1=1426798r2=1426799view=diff

 ==
 ---
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 (original)
 +++
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 Sat Dec 29 18:23:33 2012
 @@ -551,7 +551,11 @@ public class GenericKeyedObjectPoolK,T
  throw new IllegalStateException(
  Object not currently part of this pool);
  }
 -destroy(key, p, true);
 +synchronized (p) {
 +if (p.getState() != PooledObjectState.INVALID) {
 +destroy(key, p, true);
 +}
 +}
  }



 Modified:
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1426799r1=1426798r2=1426799view=diff

 ==
 ---
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 (original)
 +++
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 Sat Dec 29 18:23:33 2012
 @@ -581,10 +581,14 @@ public class GenericObjectPoolT extend
  return;
  } else {
  throw new IllegalStateException(
 -Returned object not currently part of this
 pool);
 +Invalidated object not currently part of this
 pool);
  }
  }
 -destroy(p);
 +synchronized (p) {
 +if (p.getState() != PooledObjectState.INVALID) {
 +destroy(p);
 +}
 +}
  }

  /**

 Modified:
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1426799r1=1426798r2=1426799view=diff

 ==
 ---
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 (original)
 +++
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 Sat Dec 29 18:23:33 2012
 @@ -1433,6 +1433,88 @@ public class TestGenericKeyedObjectPool
  // Check thread was interrupted
  assertTrue(wtt._thrown instanceof InterruptedException);
  }
 +
 +/**
 + * POOL-231 - verify that concurrent invalidates of the same object
 do not
 + * corrupt pool destroyCount.
 + */
 +@Test
 +public void testConcurrentInvalidate() throws Exception {
 +// Get allObjects and idleObjects loaded with some instances
 +final int nObjects = 1000;
 +final String key = one;
 +pool.setMaxTotal(nObjects);
 +pool.setMaxTotalPerKey(nObjects);
 +pool.setMaxIdlePerKey(nObjects);
 +final String [] obj = new String[nObjects];
 +for (int i = 0; i  nObjects; i++) {
 +obj[i] = pool.borrowObject(key);
 +}
 +for (int i = 0; i  nObjects; i++) {
 +if (i % 2 == 0) {
 +pool.returnObject(key, obj[i]);
 +}
 +}
 +final int nThreads = 20;
 +final int nIterations = 60;
 +final InvalidateThread[] threads = new InvalidateThread[nThreads];
 +// Randomly generated list of distinct invalidation targets
 +final ArrayListInteger targets = new ArrayListInteger();
 +final Random random = new Random();
 +for (int j = 0; j  nIterations; j++) {
 +// Get a random invalidation target
 +Integer targ = new Integer(random.nextInt(nObjects));
 +while

Re: svn commit: r1426799 - in /commons/proper/pool/trunk/src: main/java/org/apache/commons/pool2/impl/ test/java/org/apache/commons/pool2/impl/

2013-01-10 Thread Mark Thomas
On 10/01/2013 16:21, Gary Gregory wrote:
 Should this be ported to the 1.6 branch?

Don't think so. That looks to be specific to pool2.

Mark


 
 Gary
 
 
 On Sat, Dec 29, 2012 at 1:23 PM, pste...@apache.org wrote:
 
 Author: psteitz
 Date: Sat Dec 29 18:23:33 2012
 New Revision: 1426799

 URL: http://svn.apache.org/viewvc?rev=1426799view=rev
 Log:
 Fixed threadsafety problem in GOP, GKOP invalidateObject. JIRA: POOL-231.

 Modified:

 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java

 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java

 Modified:
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1426799r1=1426798r2=1426799view=diff

 ==
 ---
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 (original)
 +++
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 Sat Dec 29 18:23:33 2012
 @@ -551,7 +551,11 @@ public class GenericKeyedObjectPoolK,T
  throw new IllegalStateException(
  Object not currently part of this pool);
  }
 -destroy(key, p, true);
 +synchronized (p) {
 +if (p.getState() != PooledObjectState.INVALID) {
 +destroy(key, p, true);
 +}
 +}
  }



 Modified:
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1426799r1=1426798r2=1426799view=diff

 ==
 ---
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 (original)
 +++
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 Sat Dec 29 18:23:33 2012
 @@ -581,10 +581,14 @@ public class GenericObjectPoolT extend
  return;
  } else {
  throw new IllegalStateException(
 -Returned object not currently part of this
 pool);
 +Invalidated object not currently part of this
 pool);
  }
  }
 -destroy(p);
 +synchronized (p) {
 +if (p.getState() != PooledObjectState.INVALID) {
 +destroy(p);
 +}
 +}
  }

  /**

 Modified:
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1426799r1=1426798r2=1426799view=diff

 ==
 ---
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 (original)
 +++
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 Sat Dec 29 18:23:33 2012
 @@ -1433,6 +1433,88 @@ public class TestGenericKeyedObjectPool
  // Check thread was interrupted
  assertTrue(wtt._thrown instanceof InterruptedException);
  }
 +
 +/**
 + * POOL-231 - verify that concurrent invalidates of the same object
 do not
 + * corrupt pool destroyCount.
 + */
 +@Test
 +public void testConcurrentInvalidate() throws Exception {
 +// Get allObjects and idleObjects loaded with some instances
 +final int nObjects = 1000;
 +final String key = one;
 +pool.setMaxTotal(nObjects);
 +pool.setMaxTotalPerKey(nObjects);
 +pool.setMaxIdlePerKey(nObjects);
 +final String [] obj = new String[nObjects];
 +for (int i = 0; i  nObjects; i++) {
 +obj[i] = pool.borrowObject(key);
 +}
 +for (int i = 0; i  nObjects; i++) {
 +if (i % 2 == 0) {
 +pool.returnObject(key, obj[i]);
 +}
 +}
 +final int nThreads = 20;
 +final int nIterations = 60;
 +final InvalidateThread[] threads = new InvalidateThread[nThreads];
 +// Randomly generated list of distinct invalidation targets
 +final ArrayListInteger targets = new ArrayListInteger();
 +final Random random = new Random();
 +for (int j = 0; j  nIterations; j++) {
 +// Get a random

Re: svn commit: r1361731 - /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolConfig.java

2012-07-15 Thread Mark Thomas
On 15/07/2012 17:26, pste...@apache.org wrote:
 Author: psteitz
 Date: Sun Jul 15 16:26:57 2012
 New Revision: 1361731
 
 URL: http://svn.apache.org/viewvc?rev=1361731view=rev
 Log:
 Added no-arg constructor.

Why? That is just pointless code. I have been trying to remove that sort
of thing from pool2.

Mark

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



Re: svn commit: r1361731 - /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolConfig.java

2012-07-15 Thread Phil Steitz
I am OK leaving it out.  I added it to make it consistent with gkopconfig and 
in case we add other constructors, which I guess we won't, so I am OK to axe 
(and same for gkop)



On Jul 15, 2012, at 10:08 AM, Mark Thomas ma...@apache.org wrote:

 On 15/07/2012 17:26, pste...@apache.org wrote:
 Author: psteitz
 Date: Sun Jul 15 16:26:57 2012
 New Revision: 1361731
 
 URL: http://svn.apache.org/viewvc?rev=1361731view=rev
 Log:
 Added no-arg constructor.
 
 Why? That is just pointless code. I have been trying to remove that sort
 of thing from pool2.
 
 Mark
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
 For additional commands, e-mail: dev-h...@commons.apache.org
 

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



Re: svn commit: r1353809 - /commons/proper/pool/trunk/src/site/site.xml

2012-06-26 Thread sebb
On 26 June 2012 04:59,  pste...@apache.org wrote:
 Author: psteitz
 Date: Tue Jun 26 03:59:58 2012
 New Revision: 1353809

 URL: http://svn.apache.org/viewvc?rev=1353809view=rev
 Log:
 Updated javadoc links in preparation for 2.0 release.

 Modified:
    commons/proper/pool/trunk/src/site/site.xml

 Modified: commons/proper/pool/trunk/src/site/site.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/site/site.xml?rev=1353809r1=1353808r2=1353809view=diff
 ==
 --- commons/proper/pool/trunk/src/site/site.xml (original)
 +++ commons/proper/pool/trunk/src/site/site.xml Tue Jun 26 03:59:58 2012
 @@ -29,6 +29,8 @@
             item name=Javadoc (1.3 release)         
 href=http://commons.apache.org/pool/api-1.3/index.html/
             item name=Javadoc (1.4 release)         
 href=http://commons.apache.org/pool/api-1.4/index.html/
             item name=Javadoc (1.5.6 release)       
 href=http://commons.apache.org/pool/api-1.5.6/index.html/

Do we really still need all of the earlier releases?

 +            item name=Javadoc (1.6 release)         
 href=http://commons.apache.org/pool/api-1.6/index.html/
 +            item name=Javadoc (2.0 release)         
 href=http://commons.apache.org/pool/api-2.0/index.html/
             item name=Developers#xA0;Guide         
 href=/guide/index.html collapse=true
                 item name=Class#xA0;Diagrams       
 href=/guide/classdiagrams.html/
                 item name=Sequence#xA0;Diagrams    
 href=/guide/sequencediagrams.html/



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



Re: svn commit: r1353809 - /commons/proper/pool/trunk/src/site/site.xml

2012-06-26 Thread Gary Gregory
On Tue, Jun 26, 2012 at 6:57 AM, sebb seb...@gmail.com wrote:

 On 26 June 2012 04:59,  pste...@apache.org wrote:
  Author: psteitz
  Date: Tue Jun 26 03:59:58 2012
  New Revision: 1353809
 
  URL: http://svn.apache.org/viewvc?rev=1353809view=rev
  Log:
  Updated javadoc links in preparation for 2.0 release.
 
  Modified:
 commons/proper/pool/trunk/src/site/site.xml
 
  Modified: commons/proper/pool/trunk/src/site/site.xml
  URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/site/site.xml?rev=1353809r1=1353808r2=1353809view=diff
 
 ==
  --- commons/proper/pool/trunk/src/site/site.xml (original)
  +++ commons/proper/pool/trunk/src/site/site.xml Tue Jun 26 03:59:58 2012
  @@ -29,6 +29,8 @@
  item name=Javadoc (1.3 release) href=
 http://commons.apache.org/pool/api-1.3/index.html/
  item name=Javadoc (1.4 release) href=
 http://commons.apache.org/pool/api-1.4/index.html/
  item name=Javadoc (1.5.6 release)   href=
 http://commons.apache.org/pool/api-1.5.6/index.html/

 Do we really still need all of the earlier releases?


I could see 1.5.x, 1.6.x, and 2.0.x as being useful.

Gary


  +item name=Javadoc (1.6 release) href=
 http://commons.apache.org/pool/api-1.6/index.html/
  +item name=Javadoc (2.0 release) href=
 http://commons.apache.org/pool/api-2.0/index.html/
  item name=Developers#xA0;Guide
 href=/guide/index.html collapse=true
  item name=Class#xA0;Diagrams
 href=/guide/classdiagrams.html/
  item name=Sequence#xA0;Diagrams
  href=/guide/sequencediagrams.html/
 
 

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




-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
JUnit in Action, 2nd Ed: http://goog_1249600977http://bit.ly/ECvg0
Spring Batch in Action: http://s.apache.org/HOqhttp://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: svn commit: r1334378 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java

2012-05-05 Thread sebb AT ASF
On 5 May 2012 11:13,  s...@apache.org wrote:
 Author: sebb
 Date: Sat May  5 10:13:22 2012
 New Revision: 1334378

 URL: http://svn.apache.org/viewvc?rev=1334378view=rev
 Log:
 Add ctor tests, including null factory
 TODO determine why JMX cannot find creationStackTrace

I had to update tearDown because it was failing to find the attribute.

Not sure why this is the case. Does not seem to be able to find any attributes.

 Modified:
    
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java

 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=1334378r1=1334377r2=1334378view=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
  Sat May  5 10:13:22 2012
 @@ -31,15 +31,16 @@ import java.util.Random;
  import java.util.Set;
  import java.util.concurrent.atomic.AtomicInteger;

 +import javax.management.AttributeNotFoundException;
  import javax.management.MBeanServer;
  import javax.management.Notification;
  import javax.management.NotificationListener;
  import javax.management.ObjectName;

  import org.apache.commons.pool2.BasePoolableObjectFactory;
 +import org.apache.commons.pool2.PoolableObjectFactory;
  import org.apache.commons.pool2.ObjectPool;
  import org.apache.commons.pool2.PoolUtils;
 -import org.apache.commons.pool2.PoolableObjectFactory;
  import org.apache.commons.pool2.TestBaseObjectPool;
  import org.apache.commons.pool2.VisitTracker;
  import org.apache.commons.pool2.VisitTrackerFactory;
 @@ -100,13 +101,103 @@ public class TestGenericObjectPool exten
             // Clean these up ready for the next test
             msg.append(name.toString());
             msg.append( created via\n);
 -            msg.append(mbs.getAttribute(name, creationStackTrace));
 +            try {
 +                msg.append(mbs.getAttribute(name, creationStackTrace));
 +            } catch (AttributeNotFoundException e) {
 +                msg.append(e.getMessage());
 +            }
             msg.append('\n');
             mbs.unregisterMBean(name);
         }

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



Re: svn commit: r1334103 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

2012-05-05 Thread sebb AT ASF
On 4 May 2012 19:05, sebb AT ASF s...@apache.org wrote:
 The following change to the GKOP ctor seems to fix the problem:


        if (factory == null) {
            this.close(); // = close the parent
            throw new IllegalArgumentException(factory may not be null);
        }

 Not 100% sure if that is the correct fix - perhaps tearDown() needs to
 be adjusted?

I've fixed GOP and GKOP to call jmxUnregister() instead.
Hope that's OK; it fixes the remaining test errors.

 On 4 May 2012 19:02,  s...@apache.org wrote:
 Author: sebb
 Date: Fri May  4 18:02:27 2012
 New Revision: 1334103

 URL: http://svn.apache.org/viewvc?rev=1334103view=rev
 Log:
 Add specific test for null factory
 TODO causes tearDown error

 Modified:
    
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1334103r1=1334102r2=1334103view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  Fri May  4 18:02:27 2012
 @@ -,6 +,14 @@ public class TestGenericKeyedObjectPool
         pool.close();
     }

 +    @Test(expected=IllegalArgumentException.class)
 +    public void testConstructorNullFactory() {
 +        // add dummy assert (won't be invoked because of IAE) to avoid 
 unused warning
 +        assertNotNull(new GenericKeyedObjectPoolString,String(null));
 +        // TODO this currently causes tearDown to report an error
 +        // Looks like GKOP needs to call close() on its parent before 
 throwing IAE
 +    }
 +
     @Test(timeout=6)
     public void testExceptionOnPassivateDuringReturn() throws Exception {
         SimpleFactoryString factory = new SimpleFactoryString();



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



Re: svn commit: r1334103 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

2012-05-05 Thread Mark Thomas
On 05/05/2012 11:22, sebb AT ASF wrote:
 On 4 May 2012 19:05, sebb AT ASF s...@apache.org wrote:
 The following change to the GKOP ctor seems to fix the problem:


if (factory == null) {
this.close(); // = close the parent
throw new IllegalArgumentException(factory may not be null);
}

 Not 100% sure if that is the correct fix - perhaps tearDown() needs to
 be adjusted?
 
 I've fixed GOP and GKOP to call jmxUnregister() instead.
 Hope that's OK; it fixes the remaining test errors.

Looks good to me.

Mark

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



Re: svn commit: r1334378 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java

2012-05-05 Thread Mark Thomas
On 05/05/2012 11:20, sebb AT ASF wrote:
 On 5 May 2012 11:13,  s...@apache.org wrote:
 Author: sebb
 Date: Sat May  5 10:13:22 2012
 New Revision: 1334378

 URL: http://svn.apache.org/viewvc?rev=1334378view=rev
 Log:
 Add ctor tests, including null factory
 TODO determine why JMX cannot find creationStackTrace
 
 I had to update tearDown because it was failing to find the attribute.
 
 Not sure why this is the case. Does not seem to be able to find any 
 attributes.

Bizarre. I've fixed this but the case for the attributes isn't what I
would expect at all. Just checked the javax.management docs and this is
an intended. Oh well...

Mark

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



Re: svn commit: r1334070 - /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

2012-05-04 Thread sebb AT ASF
On 4 May 2012 18:26,  s...@apache.org wrote:
 Author: sebb
 Date: Fri May  4 17:26:46 2012
 New Revision: 1334070

 URL: http://svn.apache.org/viewvc?rev=1334070view=rev
 Log:
 Wrong place to check for null; returning prevents any entries from being 
 created

This fixes the first two test failures.

 Modified:
    
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1334070r1=1334069r2=1334070view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Fri May  4 17:26:46 2012
 @@ -1094,10 +1094,6 @@ public class GenericKeyedObjectPoolK,T
     private void ensureMinIdle(K key) throws Exception {
         // Calculate current pool objects
         ObjectDequeT objectDeque = poolMap.get(key);
 -        // Protect against NPEs in case the key has been removed
 -        if (objectDeque == null) {
 -            return;
 -        }

         // this method isn't synchronized so the
         // calculateDeficit is done at the beginning



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



Re: svn commit: r1334103 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

2012-05-04 Thread sebb AT ASF
The following change to the GKOP ctor seems to fix the problem:


if (factory == null) {
this.close(); // = close the parent
throw new IllegalArgumentException(factory may not be null);
}

Not 100% sure if that is the correct fix - perhaps tearDown() needs to
be adjusted?

On 4 May 2012 19:02,  s...@apache.org wrote:
 Author: sebb
 Date: Fri May  4 18:02:27 2012
 New Revision: 1334103

 URL: http://svn.apache.org/viewvc?rev=1334103view=rev
 Log:
 Add specific test for null factory
 TODO causes tearDown error

 Modified:
    
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1334103r1=1334102r2=1334103view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  Fri May  4 18:02:27 2012
 @@ -,6 +,14 @@ public class TestGenericKeyedObjectPool
         pool.close();
     }

 +    @Test(expected=IllegalArgumentException.class)
 +    public void testConstructorNullFactory() {
 +        // add dummy assert (won't be invoked because of IAE) to avoid 
 unused warning
 +        assertNotNull(new GenericKeyedObjectPoolString,String(null));
 +        // TODO this currently causes tearDown to report an error
 +        // Looks like GKOP needs to call close() on its parent before 
 throwing IAE
 +    }
 +
     @Test(timeout=6)
     public void testExceptionOnPassivateDuringReturn() throws Exception {
         SimpleFactoryString factory = new SimpleFactoryString();



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



Re: svn commit: r1332969 - /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java

2012-05-02 Thread sebb
On 2 May 2012 10:40,  ma...@apache.org wrote:
 Author: markt
 Date: Wed May  2 09:40:34 2012
 New Revision: 1332969

 URL: http://svn.apache.org/viewvc?rev=1332969view=rev
 Log:
 Make methods private, abstract or final. This can always be relaxed later if 
 there is a requirement.

+1 Thank you!

 Modified:
    
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java

 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=1332969r1=1332968r2=1332969view=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 May  2 09:40:34 2012
 @@ -162,7 +162,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #setMaxTotal
      */
 -    public int getMaxTotal() {
 +    public final int getMaxTotal() {
         return maxTotal;
     }

 @@ -177,7 +177,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #getMaxTotal
      */
 -    public void setMaxTotal(int maxTotal) {
 +    public final void setMaxTotal(int maxTotal) {
         this.maxTotal = maxTotal;
     }

 @@ -191,7 +191,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #setBlockWhenExhausted
      */
 -    public boolean getBlockWhenExhausted() {
 +    public final boolean getBlockWhenExhausted() {
         return blockWhenExhausted;
     }

 @@ -206,7 +206,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #getBlockWhenExhausted
      */
 -    public void setBlockWhenExhausted(boolean blockWhenExhausted) {
 +    public final void setBlockWhenExhausted(boolean blockWhenExhausted) {
         this.blockWhenExhausted = blockWhenExhausted;
     }

 @@ -223,7 +223,7 @@ public abstract class BaseGenericObjectP
      * @see #setMaxWaitMillis
      * @see #setBlockWhenExhausted
      */
 -    public long getMaxWaitMillis() {
 +    public final long getMaxWaitMillis() {
         return maxWaitMillis;
     }

 @@ -241,7 +241,7 @@ public abstract class BaseGenericObjectP
      * @see #getMaxWaitMillis
      * @see #setBlockWhenExhausted
      */
 -    public void setMaxWaitMillis(long maxWaitMillis) {
 +    public final void setMaxWaitMillis(long maxWaitMillis) {
         this.maxWaitMillis = maxWaitMillis;
     }

 @@ -257,7 +257,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #setLifo
      */
 -    public boolean getLifo() {
 +    public final boolean getLifo() {
         return lifo;
     }

 @@ -273,7 +273,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #getLifo()
      */
 -    public void setLifo(boolean lifo) {
 +    public final void setLifo(boolean lifo) {
         this.lifo = lifo;
     }

 @@ -289,7 +289,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #setTestOnBorrow
      */
 -    public boolean getTestOnBorrow() {
 +    public final boolean getTestOnBorrow() {
         return testOnBorrow;
     }

 @@ -306,7 +306,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #getTestOnBorrow
      */
 -    public void setTestOnBorrow(boolean testOnBorrow) {
 +    public final void setTestOnBorrow(boolean testOnBorrow) {
         this.testOnBorrow = testOnBorrow;
     }

 @@ -321,7 +321,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #setTestOnReturn
      */
 -    public boolean getTestOnReturn() {
 +    public final boolean getTestOnReturn() {
         return testOnReturn;
     }

 @@ -337,7 +337,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #getTestOnReturn
      */
 -    public void setTestOnReturn(boolean testOnReturn) {
 +    public final void setTestOnReturn(boolean testOnReturn) {
         this.testOnReturn = testOnReturn;
     }

 @@ -353,7 +353,7 @@ public abstract class BaseGenericObjectP
      * @see #setTestWhileIdle
      * @see #setTimeBetweenEvictionRunsMillis
      */
 -    public boolean getTestWhileIdle() {
 +    public final boolean getTestWhileIdle() {
         return testWhileIdle;
     }

 @@ -370,7 +370,7 @@ public abstract class BaseGenericObjectP
      * @see #getTestWhileIdle
      * @see #setTimeBetweenEvictionRunsMillis
      */
 -    public void setTestWhileIdle(boolean testWhileIdle) {
 +    public final void setTestWhileIdle(boolean testWhileIdle) {
         this.testWhileIdle = testWhileIdle;
     }

 @@ -383,7 +383,7 @@ public abstract class BaseGenericObjectP
      *
      * @see #setTimeBetweenEvictionRunsMillis
      */
 -    public long getTimeBetweenEvictionRunsMillis() {
 +    public final long getTimeBetweenEvictionRunsMillis() {
         return timeBetweenEvictionRunsMillis

Re: svn commit: r1332964 - /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

2012-05-02 Thread sebb
On 2 May 2012 10:28,  ma...@apache.org wrote:
 Author: markt
 Date: Wed May  2 09:28:25 2012
 New Revision: 1332964

 URL: http://svn.apache.org/viewvc?rev=1332964view=rev
 Log:
 Fix POOL-216. Efficiency improvements.

 Modified:
    
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1332964r1=1332963r2=1332964view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Wed May  2 09:28:25 2012
 @@ -1200,8 +1200,8 @@ public class GenericKeyedObjectPoolK,T
      */
     @Override
     protected void ensureMinIdle() throws Exception {
 -        int minIdle = getMinIdlePerKey();
 -        if (minIdle  1) {
 +        int minIdlePerKey = getMinIdlePerKey();
 +        if (minIdlePerKey  1) {
             return;
         }

 @@ -1223,10 +1223,6 @@ public class GenericKeyedObjectPoolK,T
      * @throws Exception If there was an error whilst creating the pooled 
 objects
      */
     private void ensureMinIdle(K key) throws Exception {
 -        int minIdle = getMinIdlePerKey();
 -        if (minIdle  1) {
 -            return;
 -        }

         // Calculate current pool objects
         ObjectDequeT objectDeque = poolMap.get(key);
 @@ -1305,6 +1301,10 @@ public class GenericKeyedObjectPoolK,T
      * @since Pool 1.3
      */
     public void preparePool(K key) throws Exception {
 +        int minIdlePerKey = getMinIdlePerKey();
 +        if (minIdlePerKey  1) {

There's actually no need for the local variable minIdlePerKey.
Not sure that is worth fixing though; it can also make debugging
marginally harder.

 +            return;
 +        }
         ensureMinIdle(key);
     }




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



Re: svn commit: r1332588 - in /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl: BaseGenericObjectPool.java GenericKeyedObjectPool.java GenericObjectPool.java

2012-05-01 Thread sebb
On 1 May 2012 10:25,  ma...@apache.org wrote:
 Author: markt
 Date: Tue May  1 09:25:35 2012
 New Revision: 1332588

 URL: http://svn.apache.org/viewvc?rev=1332588view=rev
 Log:
 Refactor so the Javadoc for GKOP doesn't point to GOP.

The Javadoc originally referred to a missing method, so I changed it
to use an interface of BGOP, which is inherited by GOP and GKOP.

Not sure how that can have resulted in GKOP referencing GOP? I don't
see that at all.

I'm only curious about the log comment; the actual change is fine.

 Modified:
    
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
    
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
    
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java

 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=1332588r1=1332587r2=1332588view=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
  Tue May  1 09:25:35 2012
 @@ -397,7 +397,7 @@ public abstract class BaseGenericObjectP
      * of the idle object evictor thread. When positive, the number of tests
      * performed for a run will be the minimum of the configured value and the
      * number of idle instances in the pool. When negative, the number of 
 tests
 -     * performed will be codeceil({@link 
 org.apache.commons.pool2.ObjectPool#getNumIdle #getNumIdle}/
 +     * performed will be codeceil({@link #getNumIdle}/
      * abs({@link #getNumTestsPerEvictionRun})) whch means that when the value
      * is code-n/code roughly one nth of the idle objects will be tested 
 per
      * run.
 @@ -416,7 +416,7 @@ public abstract class BaseGenericObjectP
      * of the idle object evictor thread. When positive, the number of tests
      * performed for a run will be the minimum of the configured value and the
      * number of idle instances in the pool. When negative, the number of 
 tests
 -     * performed will be codeceil({@link 
 org.apache.commons.pool2.ObjectPool#getNumIdle() #getNumIdle()}/
 +     * performed will be codeceil({@link #getNumIdle}/
      * abs({@link #getNumTestsPerEvictionRun})) whch means that when the value
      * is code-n/code roughly one nth of the idle objects will be tested 
 per
      * run.
 @@ -737,6 +737,11 @@ public abstract class BaseGenericObjectP
         return maxBorrowWaitTimeMillis;
     }

 +    /**
 +     * The number of instances currently idle in this pool.
 +     */
 +    public abstract int getNumIdle();
 +
     final NotificationBroadcasterSupport getJmxNotificationSupport() {
         return jmxNotificationSupport;
     }

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1332588r1=1332587r2=1332588view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Tue May  1 09:25:35 2012
 @@ -743,11 +743,6 @@ public class GenericKeyedObjectPoolK,T
         return numTotal.get() - getNumIdle();
     }

 -    /**
 -     * Returns the total number of instances currently idle in this pool.
 -     *
 -     * @return the total number of instances currently idle in this pool
 -     */
     @Override
     public int getNumIdle() {
         IteratorObjectDequeT iter = poolMap.values().iterator();

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1332588r1=1332587r2=1332588view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  Tue May  1 09:25:35 2012
 @@ -630,11 +630,6 @@ public class GenericObjectPoolT extend
         return allObjects.size() - idleObjects.size();
     }

 -    /**
 -     * Return the number of instances currently idle in this pool.
 -     *
 -     * @return the number of instances currently idle

Re: svn commit: r1332588 - in /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl: BaseGenericObjectPool.java GenericKeyedObjectPool.java GenericObjectPool.java

2012-05-01 Thread Mark Thomas
On 01/05/2012 10:44, sebb wrote:
 On 1 May 2012 10:25,  ma...@apache.org wrote:
 Author: markt
 Date: Tue May  1 09:25:35 2012
 New Revision: 1332588

 URL: http://svn.apache.org/viewvc?rev=1332588view=rev
 Log:
 Refactor so the Javadoc for GKOP doesn't point to GOP.
 
 The Javadoc originally referred to a missing method, so I changed it
 to use an interface of BGOP, which is inherited by GOP and GKOP.
 
 Not sure how that can have resulted in GKOP referencing GOP? I don't
 see that at all.
 
 I'm only curious about the log comment; the actual change is fine.

That is what I get for (mis) reading the diff on my phone.

Mark

 
 Modified:

 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java

 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java

 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=1332588r1=1332587r2=1332588view=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
  Tue May  1 09:25:35 2012
 @@ -397,7 +397,7 @@ public abstract class BaseGenericObjectP
  * of the idle object evictor thread. When positive, the number of tests
  * performed for a run will be the minimum of the configured value and 
 the
  * number of idle instances in the pool. When negative, the number of 
 tests
 - * performed will be codeceil({@link 
 org.apache.commons.pool2.ObjectPool#getNumIdle #getNumIdle}/
 + * performed will be codeceil({@link #getNumIdle}/
  * abs({@link #getNumTestsPerEvictionRun})) whch means that when the 
 value
  * is code-n/code roughly one nth of the idle objects will be tested 
 per
  * run.
 @@ -416,7 +416,7 @@ public abstract class BaseGenericObjectP
  * of the idle object evictor thread. When positive, the number of tests
  * performed for a run will be the minimum of the configured value and 
 the
  * number of idle instances in the pool. When negative, the number of 
 tests
 - * performed will be codeceil({@link 
 org.apache.commons.pool2.ObjectPool#getNumIdle() #getNumIdle()}/
 + * performed will be codeceil({@link #getNumIdle}/
  * abs({@link #getNumTestsPerEvictionRun})) whch means that when the 
 value
  * is code-n/code roughly one nth of the idle objects will be tested 
 per
  * run.
 @@ -737,6 +737,11 @@ public abstract class BaseGenericObjectP
 return maxBorrowWaitTimeMillis;
 }

 +/**
 + * The number of instances currently idle in this pool.
 + */
 +public abstract int getNumIdle();
 +
 final NotificationBroadcasterSupport getJmxNotificationSupport() {
 return jmxNotificationSupport;
 }

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1332588r1=1332587r2=1332588view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Tue May  1 09:25:35 2012
 @@ -743,11 +743,6 @@ public class GenericKeyedObjectPoolK,T
 return numTotal.get() - getNumIdle();
 }

 -/**
 - * Returns the total number of instances currently idle in this pool.
 - *
 - * @return the total number of instances currently idle in this pool
 - */
 @Override
 public int getNumIdle() {
 IteratorObjectDequeT iter = poolMap.values().iterator();

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1332588r1=1332587r2=1332588view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  Tue May  1 09:25:35 2012
 @@ -630,11 +630,6 @@ public class GenericObjectPoolT extend
 return allObjects.size() - idleObjects.size();
 }

 -/**
 - * Return the number

Re: svn commit: r1332423 - /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

2012-04-30 Thread sebb
On 30 April 2012 22:49,  ma...@apache.org wrote:
 Author: markt
 Date: Mon Apr 30 21:49:44 2012
 New Revision: 1332423

 URL: http://svn.apache.org/viewvc?rev=1332423view=rev
 Log:
 Typo

 Modified:
    
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1332423r1=1332422r2=1332423view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Mon Apr 30 21:49:44 2012
 @@ -1002,7 +1002,7 @@ public class GenericKeyedObjectPoolK,T
                             !evictionKeyIterator.hasNext()) {
                         ListK keyCopy = new ArrayListK();
                         Lock lock = keyLock.readLock();

Perhaps rename as readLock rather than the generic lock?
Makes it clearer that the following code is only read-protected.

Similarly elsewhere for writeLock.

 -                        lock .lock();
 +                        lock.lock();
                         try {
                             keyCopy.addAll(poolKeyList);
                         } finally {



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



Re: svn commit: r1329709 - in /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl: BaseObjectPoolConfig.java GenericKeyedObjectPool.java GenericKeyedObjectPoolMBean.java GenericObje

2012-04-24 Thread Mark Thomas
On 24/04/2012 14:33, ma...@apache.org wrote:
 Author: markt
 Date: Tue Apr 24 13:33:22 2012
 New Revision: 1329709
 
 URL: http://svn.apache.org/viewvc?rev=1329709view=rev
 Log:
 Javadoc for LIFO
 - reduce duplication
 - use @link / @see rather than copy/paste

My aim is to go through all of the Pool2 Javadoc making changes along
these lines. Broadly, I am trying to:
- ensure things are defined once and once only (no copy/paste although
  there are some exceptions where there are slight differences between
  GOP and GKOP)
- use @link / @see rather than copy/paste
- ensure GOP and GKOP are consistent where one would expect them to be
  consistent
- ensure all public elements have Javadoc even if it just links to a
  definition elsewhere

This is going to be a long/slow process so I'd appreciate any objections
at this point rather than towards the conclusion of the work.

Mark

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



Re: svn commit: r1329891 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/TestPoolUtils.java

2012-04-24 Thread sebb
On 24 April 2012 18:48,  ma...@apache.org wrote:
 Author: markt
 Date: Tue Apr 24 17:48:50 2012
 New Revision: 1329891

 URL: http://svn.apache.org/viewvc?rev=1329891view=rev
 Log:
 Fix an Eclipse warning

I don't get that warning; but I do now get Unnecessary
@SuppressWarnings(unused)

Would the following work for you:

@Test
public void testJavaBeanInstantiation() {
assertNotNull(new PoolUtils());
}

It works for me.

 Modified:
    
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/TestPoolUtils.java

 Modified: 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/TestPoolUtils.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/TestPoolUtils.java?rev=1329891r1=1329890r2=1329891view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/TestPoolUtils.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/TestPoolUtils.java
  Tue Apr 24 17:48:50 2012
 @@ -56,6 +56,7 @@ public class TestPoolUtils {
     /** Sleep time to let the minIdle tests run CHECK_COUNT times. */
     private static final int CHECK_SLEEP_PERIOD = CHECK_PERIOD * (CHECK_COUNT 
 - 1) + CHECK_PERIOD / 2;

 +    @SuppressWarnings(unused)
     @Test
     public void testJavaBeanInstantiation() {
         new PoolUtils();
 @@ -496,7 +497,7 @@ public class TestPoolUtils {

         Thread.sleep(1); // 10 seconds

 -
 +
         o = pool.borrowObject();
         expectedMethods.add(borrowObject);
         pool.returnObject(o);



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



Re: svn commit: r1329891 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/TestPoolUtils.java

2012-04-24 Thread Mark Thomas
On 24/04/2012 19:15, sebb wrote:
 On 24 April 2012 18:48,  ma...@apache.org wrote:
 Author: markt
 Date: Tue Apr 24 17:48:50 2012
 New Revision: 1329891

 URL: http://svn.apache.org/viewvc?rev=1329891view=rev
 Log:
 Fix an Eclipse warning
 
 I don't get that warning; but I do now get Unnecessary
 @SuppressWarnings(unused)
 
 Would the following work for you:
 
 @Test
 public void testJavaBeanInstantiation() {
 assertNotNull(new PoolUtils());
 }

Ah. This sounds like different Eclipse versions. Let me make sure I am
using the latest...

Mark

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



Re: svn commit: r1329891 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/TestPoolUtils.java

2012-04-24 Thread sebb
On 24 April 2012 19:26, Mark Thomas ma...@apache.org wrote:
 On 24/04/2012 19:15, sebb wrote:
 On 24 April 2012 18:48,  ma...@apache.org wrote:
 Author: markt
 Date: Tue Apr 24 17:48:50 2012
 New Revision: 1329891

 URL: http://svn.apache.org/viewvc?rev=1329891view=rev
 Log:
 Fix an Eclipse warning

 I don't get that warning; but I do now get Unnecessary
 @SuppressWarnings(unused)

 Would the following work for you:

     @Test
     public void testJavaBeanInstantiation() {
         assertNotNull(new PoolUtils());
     }

 Ah. This sounds like different Eclipse versions. Let me make sure I am
 using the latest...

More likely different compiler settings.

I assume the warning you are getting is because the new instance is not used.
Adding the assert should fix that.

 Mark

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


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



Re: svn commit: r1329891 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/TestPoolUtils.java

2012-04-24 Thread Mark Thomas
On 24/04/2012 19:35, sebb wrote:
 On 24 April 2012 19:26, Mark Thomas ma...@apache.org wrote:
 On 24/04/2012 19:15, sebb wrote:
 On 24 April 2012 18:48,  ma...@apache.org wrote:
 Author: markt
 Date: Tue Apr 24 17:48:50 2012
 New Revision: 1329891

 URL: http://svn.apache.org/viewvc?rev=1329891view=rev
 Log:
 Fix an Eclipse warning

 I don't get that warning; but I do now get Unnecessary
 @SuppressWarnings(unused)

 Would the following work for you:

 @Test
 public void testJavaBeanInstantiation() {
 assertNotNull(new PoolUtils());
 }

 Ah. This sounds like different Eclipse versions. Let me make sure I am
 using the latest...
 
 More likely different compiler settings.
 
 I assume the warning you are getting is because the new instance is not used.
 Adding the assert should fix that.

It does. I wasn't on the latest version so I am updating anyway.

Mark

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



Re: svn commit: r1311993 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: InterruptibleReentrantLock.java LinkedBlockingDeque.java

2012-04-10 Thread Mark Thomas
On 10/04/2012 22:12, ma...@apache.org wrote:
 Author: markt Date: Tue Apr 10 21:12:45 2012 New Revision: 1311993
 
 URL: http://svn.apache.org/viewvc?rev=1311993view=rev
 Log: Add the ability to interrupt threads waiting to remove an object
 from the queue. This is required to re-fix POOL-189 for pool2 since the
 (currently disabled) associated test case fails at the moment.

I have the GOP fix for this locally. Unfortunately it is mixed up with
some changes for POOL-131 that lead to some clean up in the unit tests,
which lead to finding some disabled tests, which lead to discovering
POOL-189 needed re-fixing.

I need to a) unpick the separate changes as best I can and b) make the
same changes for GKOP. My intention is to commit changes to GOP and GKOP
together once I have unpicked what I currently have.

Mark

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



Re: svn commit: r1242742 - in /commons/proper/pool/trunk: build.xml pom.xml

2012-03-17 Thread sebb
On 10 February 2012 11:08,  ma...@apache.org wrote:
 Author: markt
 Date: Fri Feb 10 11:08:55 2012
 New Revision: 1242742

 URL: http://svn.apache.org/viewvc?rev=1242742view=rev
 Log:
 Target Java 6 since 1.5 is out of support unless you pay for it.

But the code does not actually use any 1.6 features.

 Modified:
    commons/proper/pool/trunk/build.xml
    commons/proper/pool/trunk/pom.xml

 Modified: commons/proper/pool/trunk/build.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/build.xml?rev=1242742r1=1242741r2=1242742view=diff
 ==
 --- commons/proper/pool/trunk/build.xml (original)
 +++ commons/proper/pool/trunk/build.xml Fri Feb 10 11:08:55 2012
 @@ -61,8 +61,8 @@
       property name=javac.optimize value=false/
       property name=javac.debug value=true/
       property name=javac.deprecation value=true/
 -      property name=javac.target.version value=1.5/
 -      property name=javac.src.version value=1.5/
 +      property name=javac.target.version value=1.6/
 +      property name=javac.src.version value=1.6/
    /target

    !-- # --
 @@ -94,7 +94,7 @@
                nonavbar=false
                serialwarn=false
                source=${javac.src.version}
 -          link href=http://download.oracle.com/javase/1.5.0/docs/api//
 +          link href=http://docs.oracle.com/javase/6/docs/api//
       /javadoc
    /target


 Modified: commons/proper/pool/trunk/pom.xml
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1242742r1=1242741r2=1242742view=diff
 ==
 --- commons/proper/pool/trunk/pom.xml (original)
 +++ commons/proper/pool/trunk/pom.xml Fri Feb 10 11:08:55 2012
 @@ -135,8 +135,8 @@
   properties
     project.build.sourceEncodingUTF-8/project.build.sourceEncoding
     project.reporting.outputEncodingUTF-8/project.reporting.outputEncoding
 -    maven.compile.source1.5/maven.compile.source
 -    maven.compile.target1.5/maven.compile.target
 +    maven.compile.source1.6/maven.compile.source
 +    maven.compile.target1.6/maven.compile.target
     commons.componentidpool/commons.componentid
     commons.release.version2.0/commons.release.version
     commons.jira.idPOOL/commons.jira.id



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



Re: svn commit: r1242742 - in /commons/proper/pool/trunk: build.xml pom.xml

2012-02-10 Thread Simone Tripodi
 Author: markt
 Date: Fri Feb 10 11:08:55 2012
 New Revision: 1242742

 URL: http://svn.apache.org/viewvc?rev=1242742view=rev
 Log:
 Target Java 6 since 1.5 is out of support unless you pay for it.

+1!!!

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/

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



Re: svn commit: r1214517 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: GenericKeyedObjectPool.java GenericObjectPool.java

2011-12-22 Thread Phil Steitz
These counts only count threads waiting on the Deques.  We don't
track factory methods in progress other than creates; but it looks
to me like the estimate could be made more accurate by adding (in
GOP case) createCount - createdCount.  This is probably not that
important in practice, unless the pool has screwy settings leading
to lots of object churn.  A more likely scenario leading to negative
bias is high validation latency.  We might want to consider tracking
the number of validations in progress.

Phil

On 12/14/11 3:47 PM, ma...@apache.org wrote:
 Author: markt
 Date: Wed Dec 14 22:47:17 2011
 New Revision: 1214517

 URL: http://svn.apache.org/viewvc?rev=1214517view=rev
 Log:
 Fix POOL-159. Expose (an estimate of) the number of threads blocked waiting 
 for an object from the pool.

 Modified:
 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1214517r1=1214516r2=1214517view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Wed Dec 14 22:47:17 2011
 @@ -1816,6 +1816,50 @@ public class GenericKeyedObjectPoolK,T
  return maxBorrowWaitTimeMillis;
  }
  
 +/**
 + * Return an estimate of the number of threads currently blocked waiting 
 for
 + * an object from the pool. This is intended for monitoring only, not for
 + * synchronization control.
 + * 
 + * @return  An estimate of the number of threads currently blocked 
 waiting
 + *  for an object from the pool 
 + */
 +public int getNumWaiters() {
 +int result = 0;
 +
 +if (getBlockWhenExhausted()) {
 +IteratorObjectDequeT iter = poolMap.values().iterator();
 +
 +while (iter.hasNext()) {
 +// Assume no overflow
 +result += iter.next().getIdleObjects().getTakeQueueLength();
 +}
 +}
 +
 +return result;
 +}
 +
 +/**
 + * Return an estimate of the number of threads currently blocked waiting 
 for
 + * an object from the pool for the given key. This is intended for
 + * monitoring only, not for synchronization control.
 + * 
 + * @return  An estimate of the number of threads currently blocked 
 waiting
 + *  for an object from the pool for the given key
 + */
 +public int getNumWaiters(K key) {
 +if (getBlockWhenExhausted()) {
 +final ObjectDequeT objectDeque = poolMap.get(key);
 +if (objectDeque == null) {
 +return 0;
 +} else {
 +return objectDeque.getIdleObjects().getTakeQueueLength();
 +}
 +} else {
 +return 0;
 +}
 +}
 +
  //--- inner classes --
  
  /**

 Modified: 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1214517r1=1214516r2=1214517view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  Wed Dec 14 22:47:17 2011
 @@ -1341,6 +1341,22 @@ public class GenericObjectPoolT extend
  return maxBorrowWaitTimeMillis;
  }
  
 +/**
 + * Return an estimate of the number of threads currently blocked waiting 
 for
 + * an object from the pool. This is intended for monitoring only, not for
 + * synchronization control.
 + * 
 + * @return  An estimate of the number of threads currently blocked 
 waiting
 + *  for an object from the pool 
 + */
 +public int getNumWaiters() {
 +if (getBlockWhenExhausted()) {
 +return idleObjects.getTakeQueueLength();
 +} else {
 +return 0;
 +}
 +}
 +
  // --- inner classes --
  
  /**





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



Re: svn commit: r1213845 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: GenericKeyedObjectPoolFactory.java GenericObjectPoolFactory.java

2011-12-13 Thread Mark Thomas
On 13/12/2011 18:40, s...@apache.org wrote:
 Author: sebb
 Date: Tue Dec 13 18:40:48 2011
 New Revision: 1213845
 
 URL: http://svn.apache.org/viewvc?rev=1213845view=rev
 Log:
 Make factories thread-safe.
 [No existing tests actually used the setter methods which have now been 
 removed]

This commit removes functionality and doesn't achieve the stated
objective since the config object is accessible and not thread-safe.

I am close to vetoing this commit.

Mark

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



Re: svn commit: r1213845 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: GenericKeyedObjectPoolFactory.java GenericObjectPoolFactory.java

2011-12-13 Thread sebb
On 13 December 2011 19:32, Mark Thomas ma...@apache.org wrote:
 On 13/12/2011 18:40, s...@apache.org wrote:
 Author: sebb
 Date: Tue Dec 13 18:40:48 2011
 New Revision: 1213845

 URL: http://svn.apache.org/viewvc?rev=1213845view=rev
 Log:
 Make factories thread-safe.
 [No existing tests actually used the setter methods which have now been 
 removed]

 This commit removes functionality and doesn't achieve the stated
 objective since the config object is accessible and not thread-safe.

Oops - the config object is cloned prior to being stored by the ctor
(and was cloned by the setter) but is not cloned by the getter.
My bad; did not notice that.

That can of course be fixed, either by cloning in the get or by
removing the getter.

Even if the setter is restored, I think the getter needs to clone the
config to ensure thread-safety.

Is it useful to be able to change the factory after creation?
And are there any configuration items that it does not make sense to change?

If so, we need unit tests.

 I am close to vetoing this commit.

Fine, but the factory classes still need to be fixed.

 Mark

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


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



Re: svn commit: r1169883 - in /commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl: TestGenericKeyedObjectPool.java TestGenericObjectPool.java

2011-09-13 Thread sebb
On 12 September 2011 20:35, sebb seb...@gmail.com wrote:
 On 12 September 2011 20:32, Phil Steitz phil.ste...@gmail.com wrote:
 I assume the tests FAIL if timeout is exceeded?

 Running org.apache.commons.pool2.impl.TestGenericKeyedObjectPool
 Tests run: 44, Failures: 0, Errors: 2, Skipped: 0, Time elapsed:
 90.891 sec  FAILURE!
 ...
 Tests in error:
  testMaxActivePerKeyExceeded(org.apache.commons.pool2.impl.TestGenericKeyedObjectPool):
 test timed out after 6 milliseconds
  testClearOldest(org.apache.commons.pool2.impl.TestGenericKeyedObjectPool):
 Object has already been retured to this pool


This last error occurs sometimes; there seems to be a timing error in the test.

 See my note from a couple of days ago on the liveness issue in
 GKOP.  Once we diagnose and fix that, this should not happen.

 Phil

 On 9/12/11 12:21 PM, s...@apache.org wrote:
 Author: sebb
 Date: Mon Sep 12 19:21:48 2011
 New Revision: 1169883

 URL: http://svn.apache.org/viewvc?rev=1169883view=rev
 Log:
 Add some guard timers (may need to be adjusted)

 Modified:
     
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
     
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1169883r1=1169882r2=1169883view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  Mon Sep 12 19:21:48 2011
 @@ -113,7 +113,7 @@ public class TestGenericKeyedObjectPool
          pool = null;
      }

 -    @Test
 +    @Test(timeout=6)
      public void testNegativeMaxTotalPerKey() throws Exception {
          pool.setMaxTotalPerKey(-1);
          pool.setBlockWhenExhausted(false);
 @@ -122,7 +122,7 @@ public class TestGenericKeyedObjectPool
          pool.returnObject(,obj);
      }

 -    @Test
 +    @Test(timeout=6)
      public void testNumActiveNumIdle2() throws Exception {
          assertEquals(0,pool.getNumActive());
          assertEquals(0,pool.getNumIdle());
 @@ -172,7 +172,7 @@ public class TestGenericKeyedObjectPool
          assertEquals(2,pool.getNumIdle(B));
      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxIdle() throws Exception {
          pool.setMaxTotalPerKey(100);
          pool.setMaxIdlePerKey(8);
 @@ -207,7 +207,7 @@ public class TestGenericKeyedObjectPool

      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxTotalPerKey() throws Exception {
          pool.setMaxTotalPerKey(3);
          pool.setBlockWhenExhausted(false);
 @@ -223,7 +223,7 @@ public class TestGenericKeyedObjectPool
          }
      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxTotalPerKeyZero() throws Exception {
          pool.setMaxTotalPerKey(0);
          pool.setBlockWhenExhausted(false);
 @@ -236,7 +236,7 @@ public class TestGenericKeyedObjectPool
          }
      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxTotal() throws Exception {
          pool.setMaxTotalPerKey(2);
          pool.setMaxTotal(3);
 @@ -278,7 +278,7 @@ public class TestGenericKeyedObjectPool
                  pool.getMaxTotal());
      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxTotalZero() throws Exception {
          pool.setMaxTotal(0);
          pool.setBlockWhenExhausted(false);
 @@ -291,7 +291,7 @@ public class TestGenericKeyedObjectPool
          }
      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxTotalLRU() throws Exception {
          pool.setMaxTotalPerKey(2);
          pool.setMaxTotal(3);
 @@ -341,7 +341,7 @@ public class TestGenericKeyedObjectPool
          assertSame(o4, o7);
      }

 -    @Test
 +    @Test(timeout=6)
      public void testSettersAndGetters() throws Exception {
          GenericKeyedObjectPoolString,String pool =
              new GenericKeyedObjectPoolString,String(
 @@ -396,7 +396,7 @@ public class TestGenericKeyedObjectPool
          }
      }

 -    @Test
 +    @Test(timeout=6)
      public void testEviction() throws Exception {
          pool.setMaxIdlePerKey(500);
          pool.setMaxTotalPerKey(500);
 @@ -446,7 +446,7 @@ public class TestGenericKeyedObjectPool
          assertEquals(Should be zero idle, found  + 
 pool.getNumIdle(),0,pool.getNumIdle());
      }

 -    @Test
 +    @Test(timeout=6)
      public void testEviction2() throws Exception {
          pool.setMaxIdlePerKey(500);
          pool.setMaxTotalPerKey(500);
 @@ -517,7 +517,7 @@ public class TestGenericKeyedObjectPool

RE: svn commit: r1169883 - in /commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl: TestGenericKeyedObjectPool.java TestGenericObjectPool.java

2011-09-12 Thread Gary Gregory
You should probably use a constant instead of repeating 6 for each method.

Gary

-Original Message-
From: s...@apache.org [mailto:s...@apache.org] 
Sent: Monday, September 12, 2011 15:22 PM
To: comm...@commons.apache.org
Subject: svn commit: r1169883 - in 
/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl: 
TestGenericKeyedObjectPool.java TestGenericObjectPool.java

Author: sebb
Date: Mon Sep 12 19:21:48 2011
New Revision: 1169883

URL: http://svn.apache.org/viewvc?rev=1169883view=rev
Log:
Add some guard timers (may need to be adjusted)

Modified:

commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java

Modified: 
commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1169883r1=1169882r2=1169883view=diff
==
--- 
commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/Tes
+++ tGenericKeyedObjectPool.java Mon Sep 12 19:21:48 2011
@@ -113,7 +113,7 @@ public class TestGenericKeyedObjectPool 
 pool = null;
 }
 
-@Test
+@Test(timeout=6)
 public void testNegativeMaxTotalPerKey() throws Exception {
 pool.setMaxTotalPerKey(-1);
 pool.setBlockWhenExhausted(false);
@@ -122,7 +122,7 @@ public class TestGenericKeyedObjectPool 
 pool.returnObject(,obj);
 }
 
-@Test
+@Test(timeout=6)
 public void testNumActiveNumIdle2() throws Exception {
 assertEquals(0,pool.getNumActive());
 assertEquals(0,pool.getNumIdle());
@@ -172,7 +172,7 @@ public class TestGenericKeyedObjectPool 
 assertEquals(2,pool.getNumIdle(B));
 }
 
-@Test
+@Test(timeout=6)
 public void testMaxIdle() throws Exception {
 pool.setMaxTotalPerKey(100);
 pool.setMaxIdlePerKey(8);
@@ -207,7 +207,7 @@ public class TestGenericKeyedObjectPool 
  
 }
 
-@Test
+@Test(timeout=6)
 public void testMaxTotalPerKey() throws Exception {
 pool.setMaxTotalPerKey(3);
 pool.setBlockWhenExhausted(false);
@@ -223,7 +223,7 @@ public class TestGenericKeyedObjectPool 
 }
 }
 
-@Test
+@Test(timeout=6)
 public void testMaxTotalPerKeyZero() throws Exception {
 pool.setMaxTotalPerKey(0);
 pool.setBlockWhenExhausted(false);
@@ -236,7 +236,7 @@ public class TestGenericKeyedObjectPool 
 }
 }
 
-@Test
+@Test(timeout=6)
 public void testMaxTotal() throws Exception {
 pool.setMaxTotalPerKey(2);
 pool.setMaxTotal(3);
@@ -278,7 +278,7 @@ public class TestGenericKeyedObjectPool 
 pool.getMaxTotal());
 }
 
-@Test
+@Test(timeout=6)
 public void testMaxTotalZero() throws Exception {
 pool.setMaxTotal(0);
 pool.setBlockWhenExhausted(false);
@@ -291,7 +291,7 @@ public class TestGenericKeyedObjectPool 
 }
 }
 
-@Test
+@Test(timeout=6)
 public void testMaxTotalLRU() throws Exception {
 pool.setMaxTotalPerKey(2);
 pool.setMaxTotal(3);
@@ -341,7 +341,7 @@ public class TestGenericKeyedObjectPool 
 assertSame(o4, o7);
 }
 
-@Test
+@Test(timeout=6)
 public void testSettersAndGetters() throws Exception {
 GenericKeyedObjectPoolString,String pool =
 new GenericKeyedObjectPoolString,String(
@@ -396,7 +396,7 @@ public class TestGenericKeyedObjectPool 
 }
 }
 
-@Test
+@Test(timeout=6)
 public void testEviction() throws Exception {
 pool.setMaxIdlePerKey(500);
 pool.setMaxTotalPerKey(500);
@@ -446,7 +446,7 @@ public class TestGenericKeyedObjectPool 
 assertEquals(Should be zero idle, found  + 
pool.getNumIdle(),0,pool.getNumIdle());
 }
 
-@Test
+@Test(timeout=6)
 public void testEviction2() throws Exception {
 pool.setMaxIdlePerKey(500);
 pool.setMaxTotalPerKey(500);
@@ -517,7 +517,7 @@ public class TestGenericKeyedObjectPool 
 }
 }
 
-@Test
+@Test(timeout=6)
 public void testThreaded1() throws Exception {
 pool.setMaxTotalPerKey(15);
 pool.setMaxIdlePerKey(15);
@@ -530,7 +530,7 @@ public class TestGenericKeyedObjectPool 
  * has high latency, testOnReturn is set and there is high incidence of
  * validation failures. 
  */
-@Test
+@Test(timeout=6)
 public void testMaxTotalInvariant() throws Exception {
 int maxTotal = 15;
 SimpleFactoryString factory = new SimpleFactoryString(); @@ -546,7 
+546,7

Re: svn commit: r1169883 - in /commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl: TestGenericKeyedObjectPool.java TestGenericObjectPool.java

2011-09-12 Thread Phil Steitz
I assume the tests FAIL if timeout is exceeded?

See my note from a couple of days ago on the liveness issue in
GKOP.  Once we diagnose and fix that, this should not happen.

Phil

On 9/12/11 12:21 PM, s...@apache.org wrote:
 Author: sebb
 Date: Mon Sep 12 19:21:48 2011
 New Revision: 1169883

 URL: http://svn.apache.org/viewvc?rev=1169883view=rev
 Log:
 Add some guard timers (may need to be adjusted)

 Modified:
 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1169883r1=1169882r2=1169883view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  Mon Sep 12 19:21:48 2011
 @@ -113,7 +113,7 @@ public class TestGenericKeyedObjectPool 
  pool = null;
  }
  
 -@Test
 +@Test(timeout=6)
  public void testNegativeMaxTotalPerKey() throws Exception {
  pool.setMaxTotalPerKey(-1);
  pool.setBlockWhenExhausted(false);
 @@ -122,7 +122,7 @@ public class TestGenericKeyedObjectPool 
  pool.returnObject(,obj);
  }
  
 -@Test
 +@Test(timeout=6)
  public void testNumActiveNumIdle2() throws Exception {
  assertEquals(0,pool.getNumActive());
  assertEquals(0,pool.getNumIdle());
 @@ -172,7 +172,7 @@ public class TestGenericKeyedObjectPool 
  assertEquals(2,pool.getNumIdle(B));
  }
  
 -@Test
 +@Test(timeout=6)
  public void testMaxIdle() throws Exception {
  pool.setMaxTotalPerKey(100);
  pool.setMaxIdlePerKey(8);
 @@ -207,7 +207,7 @@ public class TestGenericKeyedObjectPool 
   
  }
  
 -@Test
 +@Test(timeout=6)
  public void testMaxTotalPerKey() throws Exception {
  pool.setMaxTotalPerKey(3);
  pool.setBlockWhenExhausted(false);
 @@ -223,7 +223,7 @@ public class TestGenericKeyedObjectPool 
  }
  }
  
 -@Test
 +@Test(timeout=6)
  public void testMaxTotalPerKeyZero() throws Exception {
  pool.setMaxTotalPerKey(0);
  pool.setBlockWhenExhausted(false);
 @@ -236,7 +236,7 @@ public class TestGenericKeyedObjectPool 
  }
  }
  
 -@Test
 +@Test(timeout=6)
  public void testMaxTotal() throws Exception {
  pool.setMaxTotalPerKey(2);
  pool.setMaxTotal(3);
 @@ -278,7 +278,7 @@ public class TestGenericKeyedObjectPool 
  pool.getMaxTotal());
  }
  
 -@Test
 +@Test(timeout=6)
  public void testMaxTotalZero() throws Exception {
  pool.setMaxTotal(0);
  pool.setBlockWhenExhausted(false);
 @@ -291,7 +291,7 @@ public class TestGenericKeyedObjectPool 
  }
  }
  
 -@Test
 +@Test(timeout=6)
  public void testMaxTotalLRU() throws Exception {
  pool.setMaxTotalPerKey(2);
  pool.setMaxTotal(3);
 @@ -341,7 +341,7 @@ public class TestGenericKeyedObjectPool 
  assertSame(o4, o7);
  }
  
 -@Test
 +@Test(timeout=6)
  public void testSettersAndGetters() throws Exception {
  GenericKeyedObjectPoolString,String pool =
  new GenericKeyedObjectPoolString,String(
 @@ -396,7 +396,7 @@ public class TestGenericKeyedObjectPool 
  }
  }
  
 -@Test
 +@Test(timeout=6)
  public void testEviction() throws Exception {
  pool.setMaxIdlePerKey(500);
  pool.setMaxTotalPerKey(500);
 @@ -446,7 +446,7 @@ public class TestGenericKeyedObjectPool 
  assertEquals(Should be zero idle, found  + 
 pool.getNumIdle(),0,pool.getNumIdle());
  }
  
 -@Test
 +@Test(timeout=6)
  public void testEviction2() throws Exception {
  pool.setMaxIdlePerKey(500);
  pool.setMaxTotalPerKey(500);
 @@ -517,7 +517,7 @@ public class TestGenericKeyedObjectPool 
  }
  }
  
 -@Test
 +@Test(timeout=6)
  public void testThreaded1() throws Exception {
  pool.setMaxTotalPerKey(15);
  pool.setMaxIdlePerKey(15);
 @@ -530,7 +530,7 @@ public class TestGenericKeyedObjectPool 
   * has high latency, testOnReturn is set and there is high incidence of
   * validation failures. 
   */
 -@Test
 +@Test(timeout=6)
  public void testMaxTotalInvariant() throws Exception {
  int maxTotal = 15;
  SimpleFactoryString factory = new SimpleFactoryString();
 @@ -546,7 +546,7 @@ public class

Re: svn commit: r1169883 - in /commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl: TestGenericKeyedObjectPool.java TestGenericObjectPool.java

2011-09-12 Thread sebb
On 12 September 2011 20:32, Phil Steitz phil.ste...@gmail.com wrote:
 I assume the tests FAIL if timeout is exceeded?

Running org.apache.commons.pool2.impl.TestGenericKeyedObjectPool
Tests run: 44, Failures: 0, Errors: 2, Skipped: 0, Time elapsed:
90.891 sec  FAILURE!
...
Tests in error:
  
testMaxActivePerKeyExceeded(org.apache.commons.pool2.impl.TestGenericKeyedObjectPool):
test timed out after 6 milliseconds
  testClearOldest(org.apache.commons.pool2.impl.TestGenericKeyedObjectPool):
Object has already been retured to this pool

 See my note from a couple of days ago on the liveness issue in
 GKOP.  Once we diagnose and fix that, this should not happen.

 Phil

 On 9/12/11 12:21 PM, s...@apache.org wrote:
 Author: sebb
 Date: Mon Sep 12 19:21:48 2011
 New Revision: 1169883

 URL: http://svn.apache.org/viewvc?rev=1169883view=rev
 Log:
 Add some guard timers (may need to be adjusted)

 Modified:
     
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
     
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1169883r1=1169882r2=1169883view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
  Mon Sep 12 19:21:48 2011
 @@ -113,7 +113,7 @@ public class TestGenericKeyedObjectPool
          pool = null;
      }

 -    @Test
 +    @Test(timeout=6)
      public void testNegativeMaxTotalPerKey() throws Exception {
          pool.setMaxTotalPerKey(-1);
          pool.setBlockWhenExhausted(false);
 @@ -122,7 +122,7 @@ public class TestGenericKeyedObjectPool
          pool.returnObject(,obj);
      }

 -    @Test
 +    @Test(timeout=6)
      public void testNumActiveNumIdle2() throws Exception {
          assertEquals(0,pool.getNumActive());
          assertEquals(0,pool.getNumIdle());
 @@ -172,7 +172,7 @@ public class TestGenericKeyedObjectPool
          assertEquals(2,pool.getNumIdle(B));
      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxIdle() throws Exception {
          pool.setMaxTotalPerKey(100);
          pool.setMaxIdlePerKey(8);
 @@ -207,7 +207,7 @@ public class TestGenericKeyedObjectPool

      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxTotalPerKey() throws Exception {
          pool.setMaxTotalPerKey(3);
          pool.setBlockWhenExhausted(false);
 @@ -223,7 +223,7 @@ public class TestGenericKeyedObjectPool
          }
      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxTotalPerKeyZero() throws Exception {
          pool.setMaxTotalPerKey(0);
          pool.setBlockWhenExhausted(false);
 @@ -236,7 +236,7 @@ public class TestGenericKeyedObjectPool
          }
      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxTotal() throws Exception {
          pool.setMaxTotalPerKey(2);
          pool.setMaxTotal(3);
 @@ -278,7 +278,7 @@ public class TestGenericKeyedObjectPool
                  pool.getMaxTotal());
      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxTotalZero() throws Exception {
          pool.setMaxTotal(0);
          pool.setBlockWhenExhausted(false);
 @@ -291,7 +291,7 @@ public class TestGenericKeyedObjectPool
          }
      }

 -    @Test
 +    @Test(timeout=6)
      public void testMaxTotalLRU() throws Exception {
          pool.setMaxTotalPerKey(2);
          pool.setMaxTotal(3);
 @@ -341,7 +341,7 @@ public class TestGenericKeyedObjectPool
          assertSame(o4, o7);
      }

 -    @Test
 +    @Test(timeout=6)
      public void testSettersAndGetters() throws Exception {
          GenericKeyedObjectPoolString,String pool =
              new GenericKeyedObjectPoolString,String(
 @@ -396,7 +396,7 @@ public class TestGenericKeyedObjectPool
          }
      }

 -    @Test
 +    @Test(timeout=6)
      public void testEviction() throws Exception {
          pool.setMaxIdlePerKey(500);
          pool.setMaxTotalPerKey(500);
 @@ -446,7 +446,7 @@ public class TestGenericKeyedObjectPool
          assertEquals(Should be zero idle, found  + 
 pool.getNumIdle(),0,pool.getNumIdle());
      }

 -    @Test
 +    @Test(timeout=6)
      public void testEviction2() throws Exception {
          pool.setMaxIdlePerKey(500);
          pool.setMaxTotalPerKey(500);
 @@ -517,7 +517,7 @@ public class TestGenericKeyedObjectPool
          }
      }

 -    @Test
 +    @Test(timeout=6)
      public void testThreaded1() throws Exception {
          pool.setMaxTotalPerKey(15

Re: svn commit: r1164625 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

2011-09-03 Thread markt
Phil Steitz phil.ste...@gmail.com wrote:

On 9/2/11 9:48 AM, ma...@apache.org wrote:
 Author: markt
 Date: Fri Sep  2 16:48:59 2011
 New Revision: 1164625

 URL: http://svn.apache.org/viewvc?rev=1164625view=rev
 Log:
 Fix typo

I guess you meant, remove trailing spaces or tabs or something?

Phil

Nope. What I typed is what I meant.

Mark


 Modified:

commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

 Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL:
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1164625r1=1164624r2=1164625view=diff

==
 ---
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
(original)
 +++
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Fri Sep  2 16:48:59 2011
 @@ -1329,21 +1329,21 @@ public class GenericKeyedObjectPoolK,T
  return p;
  }
  
 -private boolean destroy(K key, PooledObjectT toDestory,
boolean always)
 +private boolean destroy(K key, PooledObjectT toDestroy,
boolean always)
  throws Exception {
  
  register(key);
 -toDestory.invalidate();
 +toDestroy.invalidate();
  
  try {
  ObjectDequeT objectDeque = poolMap.get(key);
 -boolean isIdle =
objectDeque.getIdleObjects().remove(toDestory);
 +boolean isIdle =
objectDeque.getIdleObjects().remove(toDestroy);
  
  if (isIdle || always) {
 -   
objectDeque.getAllObjects().remove(toDestory.getObject());
 +   
objectDeque.getAllObjects().remove(toDestroy.getObject());
  
  try {
 -_factory.destroyObject(key,
toDestory.getObject());
 +_factory.destroyObject(key,
toDestroy.getObject());
  } finally {
  objectDeque.getCreateCount().decrementAndGet();
  destroyedCount.incrementAndGet();





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





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



Re: svn commit: r1164625 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

2011-09-03 Thread Phil Steitz
On 9/3/11 1:07 AM, ma...@apache.org wrote:
 Phil Steitz phil.ste...@gmail.com wrote:

 On 9/2/11 9:48 AM, ma...@apache.org wrote:
 Author: markt
 Date: Fri Sep  2 16:48:59 2011
 New Revision: 1164625

 URL: http://svn.apache.org/viewvc?rev=1164625view=rev
 Log:
 Fix typo
 I guess you meant, remove trailing spaces or tabs or something?

 Phil
 Nope. What I typed is what I meant.

Sorry, blind last night :)

Phil

 Mark

 Modified:

 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 Modified:
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL:
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1164625r1=1164624r2=1164625view=diff
 ==
 ---
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 (original)
 +++
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 Fri Sep  2 16:48:59 2011
 @@ -1329,21 +1329,21 @@ public class GenericKeyedObjectPoolK,T
  return p;
  }
  
 -private boolean destroy(K key, PooledObjectT toDestory,
 boolean always)
 +private boolean destroy(K key, PooledObjectT toDestroy,
 boolean always)
  throws Exception {
  
  register(key);
 -toDestory.invalidate();
 +toDestroy.invalidate();
  
  try {
  ObjectDequeT objectDeque = poolMap.get(key);
 -boolean isIdle =
 objectDeque.getIdleObjects().remove(toDestory);
 +boolean isIdle =
 objectDeque.getIdleObjects().remove(toDestroy);
  
  if (isIdle || always) {
 -   
 objectDeque.getAllObjects().remove(toDestory.getObject());
 +   
 objectDeque.getAllObjects().remove(toDestroy.getObject());
  
  try {
 -_factory.destroyObject(key,
 toDestory.getObject());
 +_factory.destroyObject(key,
 toDestroy.getObject());
  } finally {
  objectDeque.getCreateCount().decrementAndGet();
  destroyedCount.incrementAndGet();




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




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




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



Re: svn commit: r1164625 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

2011-09-02 Thread Phil Steitz
On 9/2/11 9:48 AM, ma...@apache.org wrote:
 Author: markt
 Date: Fri Sep  2 16:48:59 2011
 New Revision: 1164625

 URL: http://svn.apache.org/viewvc?rev=1164625view=rev
 Log:
 Fix typo

I guess you meant, remove trailing spaces or tabs or something?

Phil

 Modified:
 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1164625r1=1164624r2=1164625view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Fri Sep  2 16:48:59 2011
 @@ -1329,21 +1329,21 @@ public class GenericKeyedObjectPoolK,T
  return p;
  }
  
 -private boolean destroy(K key, PooledObjectT toDestory, boolean always)
 +private boolean destroy(K key, PooledObjectT toDestroy, boolean always)
  throws Exception {
  
  register(key);
 -toDestory.invalidate();
 +toDestroy.invalidate();
  
  try {
  ObjectDequeT objectDeque = poolMap.get(key);
 -boolean isIdle = objectDeque.getIdleObjects().remove(toDestory);
 +boolean isIdle = objectDeque.getIdleObjects().remove(toDestroy);
  
  if (isIdle || always) {
 -objectDeque.getAllObjects().remove(toDestory.getObject());
 +objectDeque.getAllObjects().remove(toDestroy.getObject());
  
  try {
 -_factory.destroyObject(key, toDestory.getObject());
 +_factory.destroyObject(key, toDestroy.getObject());
  } finally {
  objectDeque.getCreateCount().decrementAndGet();
  destroyedCount.incrementAndGet();





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



Re: svn commit: r1163864 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

2011-09-01 Thread Mark Thomas
On 01/09/2011 00:57, sebb wrote:
 On 1 September 2011 00:10,  ma...@apache.org wrote:
 Author: markt
 Date: Wed Aug 31 23:10:53 2011
 New Revision: 1163864

 URL: http://svn.apache.org/viewvc?rev=1163864view=rev
 Log:
 Stop multiple calls to close() triggering an JMX error

 Modified:

 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1163864r1=1163863r2=1163864view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Wed Aug 31 23:10:53 2011
 @@ -1098,7 +1098,10 @@ public class GenericKeyedObjectPoolK,T
  evictionIterator = null;
  evictionKeyIterator = null;
  startEvictor(-1L);
 - ManagementFactory.getPlatformMBeanServer().unregisterMBean(oname);
 + if (oname != null) {
 + 
 ManagementFactory.getPlatformMBeanServer().unregisterMBean(oname);
 + oname = null;
 + }
  }
 
 If close() can be called from mulitple threads, then it's still
 possible to unregister the bean twice.

Yep. This was more a quick fix to get past the unit test failures.

 I think the only way to fix this would be to synchronise the block -
 making oname volatile would not help here.
 Alternatively, use an atomic boolean to record the fact that the bean
 has been registered.

I'll take a look and see what is cleanest. I'd rather not introduce a
sync on the pool if I can help it.

Mark

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



Re: svn commit: r1164053 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: GenericKeyedObjectPool.java GenericObjectPool.java

2011-09-01 Thread sebb
On 1 September 2011 13:51,  ma...@apache.org wrote:
 Author: markt
 Date: Thu Sep  1 12:51:04 2011
 New Revision: 1164053

 URL: http://svn.apache.org/viewvc?rev=1164053view=rev
 Log:
 Make close() thread safe and ensure multiple calls to close() are handled 
 correctly

 Modified:
    
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
    
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1164053r1=1164052r2=1164053view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Thu Sep  1 12:51:04 2011
 @@ -1093,15 +1093,26 @@ public class GenericKeyedObjectPoolK,T
       */
      @Override
      public void close() throws Exception {
 -         super.close();
 -         clear();
 -         evictionIterator = null;
 -         evictionKeyIterator = null;
 -         startEvictor(-1L);
 -         if (oname != null) {
 -             
 ManagementFactory.getPlatformMBeanServer().unregisterMBean(oname);
 -             oname = null;
 +         if (isClosed()) {
 +             return;
          }
 +
 +         synchronized (closeLock) {
 +             if (isClosed()) {
 +                 return;
 +             }
 +
 +             super.close();
 +             clear();
 +             evictionIterator = null;
 +             evictionKeyIterator = null;
 +             startEvictor(-1L);
 +             if (oname != null) {
 +                 ManagementFactory.getPlatformMBeanServer().unregisterMBean(
 +                         oname);

 oname = null; // ??

 +             }
 +         }
 +
      }


 @@ -1947,6 +1958,9 @@ public class GenericKeyedObjectPoolK,T
      */
     private K evictionKey = null;

 +    /** Object used to ensure closed() is only called once. */
 +    private final Object closeLock = new Object();
 +
     // JMX specific attributes
     private static final int AVERAGE_TIMING_STATS_CACHE_SIZE = 100;
     private AtomicLong borrowedCount = new AtomicLong(0);

 Modified: 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1164053r1=1164052r2=1164053view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
  Thu Sep  1 12:51:04 2011
 @@ -1002,12 +1002,22 @@ public class GenericObjectPoolT extend
      */
     @Override
     public void close() throws Exception {
 -        super.close();
 -        clear();
 -        startEvictor(-1L);
 -        if (oname != null) {
 -            
 ManagementFactory.getPlatformMBeanServer().unregisterMBean(oname);
 -            oname = null;
 +        if (isClosed()) {
 +            return;
 +        }
 +
 +        synchronized (closeLock) {
 +            if (isClosed()) {
 +                return;
 +            }
 +
 +            super.close();
 +            clear();
 +            startEvictor(-1L);
 +            if (oname != null) {
 +                ManagementFactory.getPlatformMBeanServer().unregisterMBean(
 +                        oname);

 oname = null; // ??

 +            }
         }
     }

 @@ -1541,6 +1551,9 @@ public class GenericObjectPoolT extend
     /** An iterator for {@link #idleObjects} that is used by the evictor. */
     private IteratorPooledObjectT evictionIterator = null;

 +    /** Object used to ensure closed() is only called once. */
 +    private final Object closeLock = new Object();
 +
     // JMX specific attributes
     private static final int AVERAGE_TIMING_STATS_CACHE_SIZE = 100;
     private AtomicLong borrowedCount = new AtomicLong(0);




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



Re: svn commit: r1164051 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

2011-09-01 Thread Phil Steitz
On 9/1/11 5:41 AM, ma...@apache.org wrote:
 Author: markt
 Date: Thu Sep  1 12:41:54 2011
 New Revision: 1164051

 URL: http://svn.apache.org/viewvc?rev=1164051view=rev
 Log:
 Remove sync that wasn't helping.
 Make thread safe

I agree that the sync wasn't helping; but I am not sure exactly what
thread safe means for this method.  I have always worried about
this method.  I have usually been able to convince myself that it's
incorrectness is harmless (i.e., there are guards to prevent pool
invariants being violated due to incorrect / inconsistent return
value), but I am not sure that is right.  It might be good to
temporarily make this method protected and run some concurrency
tests directly against it, so we can understand and document what
happens when instances come in and out of the pool while it is
executing.

Phil

 Modified:
 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

 Modified: 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 URL: 
 http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1164051r1=1164050r2=1164051view=diff
 ==
 --- 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  (original)
 +++ 
 commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
  Thu Sep  1 12:41:54 2011
 @@ -1577,25 +1577,30 @@ public class GenericKeyedObjectPoolK,T
   * @param pool the ObjectPool to calculate the deficit for
   * @return The number of objects to be created
   */
 -private synchronized int calculateDeficit(ObjectDequeT objectDeque) {
 +private int calculateDeficit(ObjectDequeT objectDeque) {
  
  if (objectDeque == null) {
  return getMinIdlePerKey();
  }
 +
 +// Used more than once so keep a local copy so the value is 
 consistent
 +int maxTotal = getMaxTotal();
 +int maxTotalPerKey = getMaxTotalPerKey();
 +
  int objectDefecit = 0;
 -
 +
  // Calculate no of objects needed to be created, in order to have
  // the number of pooled objects  maxTotalPerKey();
  objectDefecit = getMinIdlePerKey() - 
 objectDeque.getIdleObjects().size();
 -if (getMaxTotalPerKey()  0) {
 +if (maxTotalPerKey  0) {
  int growLimit = Math.max(0,
 -getMaxTotalPerKey() - 
 objectDeque.getIdleObjects().size());
 +maxTotalPerKey - objectDeque.getIdleObjects().size());
  objectDefecit = Math.min(objectDefecit, growLimit);
  }
  
  // Take the maxTotal limit into account
 -if (getMaxTotal()  0) {
 -int growLimit = Math.max(0, getMaxTotal() - getNumActive() - 
 getNumIdle());
 +if (maxTotal  0) {
 +int growLimit = Math.max(0, maxTotal - getNumActive() - 
 getNumIdle());
  objectDefecit = Math.min(objectDefecit, growLimit);
  }
  





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



  1   2   3   >