You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2010/12/22 15:53:00 UTC
Re: svn commit: r1051852 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl:
StackObjectPool.java StackObjectPoolFactory.java
On 22 December 2010 11:36, <si...@apache.org> wrote:
> Author: simonetripodi
> Date: Wed Dec 22 11:36:49 2010
> New Revision: 1051852
>
> URL: http://svn.apache.org/viewvc?rev=1051852&view=rev
> Log:
> made classes fields volatile
> removed synchronization on getters/setters methods
Need to remove whichever @GuardedBy comments are no longer true.
> Modified:
> commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
> commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java
>
> Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
> URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java?rev=1051852&r1=1051851&r2=1051852&view=diff
> ==============================================================================
> --- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java (original)
> +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java Wed Dec 22 11:36:49 2010
> @@ -226,7 +226,7 @@ public class StackObjectPool<T> extends
> * @return the number of instances currently borrowed from this pool
> */
> @Override
> - public synchronized int getNumActive() {
> + public int getNumActive() {
> return _numActive;
> }
>
> @@ -332,12 +332,12 @@ public class StackObjectPool<T> extends
> /**
> * cap on the number of "sleeping" instances in the pool
> */
> - private int maxSleeping; // @GuardedBy("this")
> + private volatile int maxSleeping; // @GuardedBy("this")
>
> /**
> * Number of objects borrowed but not yet returned to the pool.
> */
> - private int _numActive = 0; // @GuardedBy("this")
> + private volatile int _numActive = 0; // @GuardedBy("this")
>
> /**
> * Returns the {@link PoolableObjectFactory} used by this pool to create and manage object instances.
> @@ -355,7 +355,7 @@ public class StackObjectPool<T> extends
> * @return maxSleeping
> * @since 1.5.5
> */
> - public synchronized int getMaxSleeping() {
> + public int getMaxSleeping() {
> return this.maxSleeping;
> }
>
> @@ -365,7 +365,7 @@ public class StackObjectPool<T> extends
> * @param maxSleeping
> * @since 2.0
> */
> - public synchronized void setMaxSleeping(int maxSleeping) {
> + public void setMaxSleeping(int maxSleeping) {
> this.maxSleeping = maxSleeping;
> }
> }
>
> Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java
> URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java?rev=1051852&r1=1051851&r2=1051852&view=diff
> ==============================================================================
> --- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java (original)
> +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java Wed Dec 22 11:36:49 2010
> @@ -80,13 +80,13 @@ public class StackObjectPoolFactory<T> i
> /**
> * cap on the number of "sleeping" instances in the pool
> */
> - private int maxSleeping; // @GuardedBy("this")
> + private volatile int maxSleeping; // @GuardedBy("this")
>
> /**
> * initial size of the pool (this specifies the size of the container,
> * it does not cause the pool to be pre-populated.)
> */
> - private int initIdleCapacity; // @GuardedBy("this")
> + private volatile int initIdleCapacity; // @GuardedBy("this")
>
> /**
> * Returns the factory used by created pools.
> @@ -104,7 +104,7 @@ public class StackObjectPoolFactory<T> i
> * @return the maximum number of idle instances in created pools
> * @since 1.5.5
> */
> - public synchronized int getMaxSleeping() {
> + public int getMaxSleeping() {
> return this.maxSleeping;
> }
>
> @@ -114,7 +114,7 @@ public class StackObjectPoolFactory<T> i
> * @param maxSleeping
> * @since 2.0
> */
> - public synchronized void setMaxSleeping(int maxSleeping) {
> + public void setMaxSleeping(int maxSleeping) {
> this.maxSleeping = maxSleeping;
> }
>
> @@ -124,7 +124,7 @@ public class StackObjectPoolFactory<T> i
> * @return size of created containers (created pools are not pre-populated)
> * @since 1.5.5
> */
> - public synchronized int getInitCapacity() {
> + public int getInitCapacity() {
> return this.initIdleCapacity;
> }
>
> @@ -133,7 +133,7 @@ public class StackObjectPoolFactory<T> i
> *
> * @param initIdleCapacity size of created containers (created pools are not pre-populated)
> */
> - public synchronized void setInitCapacity(int initIdleCapacity) {
> + public void setInitCapacity(int initIdleCapacity) {
> this.initIdleCapacity = initIdleCapacity;
> }
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1051852 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl:
StackObjectPool.java StackObjectPoolFactory.java
Posted by Simone Tripodi <si...@gmail.com>.
going to fix it now, thanks :)
Simo
http://people.apache.org/~simonetripodi/
http://www.99soft.org/
On Wed, Dec 22, 2010 at 3:53 PM, sebb <se...@gmail.com> wrote:
> On 22 December 2010 11:36, <si...@apache.org> wrote:
>> Author: simonetripodi
>> Date: Wed Dec 22 11:36:49 2010
>> New Revision: 1051852
>>
>> URL: http://svn.apache.org/viewvc?rev=1051852&view=rev
>> Log:
>> made classes fields volatile
>> removed synchronization on getters/setters methods
>
> Need to remove whichever @GuardedBy comments are no longer true.
>
>> Modified:
>> commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
>> commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java
>>
>> Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
>> URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java?rev=1051852&r1=1051851&r2=1051852&view=diff
>> ==============================================================================
>> --- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java (original)
>> +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java Wed Dec 22 11:36:49 2010
>> @@ -226,7 +226,7 @@ public class StackObjectPool<T> extends
>> * @return the number of instances currently borrowed from this pool
>> */
>> @Override
>> - public synchronized int getNumActive() {
>> + public int getNumActive() {
>> return _numActive;
>> }
>>
>> @@ -332,12 +332,12 @@ public class StackObjectPool<T> extends
>> /**
>> * cap on the number of "sleeping" instances in the pool
>> */
>> - private int maxSleeping; // @GuardedBy("this")
>> + private volatile int maxSleeping; // @GuardedBy("this")
>>
>> /**
>> * Number of objects borrowed but not yet returned to the pool.
>> */
>> - private int _numActive = 0; // @GuardedBy("this")
>> + private volatile int _numActive = 0; // @GuardedBy("this")
>>
>> /**
>> * Returns the {@link PoolableObjectFactory} used by this pool to create and manage object instances.
>> @@ -355,7 +355,7 @@ public class StackObjectPool<T> extends
>> * @return maxSleeping
>> * @since 1.5.5
>> */
>> - public synchronized int getMaxSleeping() {
>> + public int getMaxSleeping() {
>> return this.maxSleeping;
>> }
>>
>> @@ -365,7 +365,7 @@ public class StackObjectPool<T> extends
>> * @param maxSleeping
>> * @since 2.0
>> */
>> - public synchronized void setMaxSleeping(int maxSleeping) {
>> + public void setMaxSleeping(int maxSleeping) {
>> this.maxSleeping = maxSleeping;
>> }
>> }
>>
>> Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java
>> URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java?rev=1051852&r1=1051851&r2=1051852&view=diff
>> ==============================================================================
>> --- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java (original)
>> +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolFactory.java Wed Dec 22 11:36:49 2010
>> @@ -80,13 +80,13 @@ public class StackObjectPoolFactory<T> i
>> /**
>> * cap on the number of "sleeping" instances in the pool
>> */
>> - private int maxSleeping; // @GuardedBy("this")
>> + private volatile int maxSleeping; // @GuardedBy("this")
>>
>> /**
>> * initial size of the pool (this specifies the size of the container,
>> * it does not cause the pool to be pre-populated.)
>> */
>> - private int initIdleCapacity; // @GuardedBy("this")
>> + private volatile int initIdleCapacity; // @GuardedBy("this")
>>
>> /**
>> * Returns the factory used by created pools.
>> @@ -104,7 +104,7 @@ public class StackObjectPoolFactory<T> i
>> * @return the maximum number of idle instances in created pools
>> * @since 1.5.5
>> */
>> - public synchronized int getMaxSleeping() {
>> + public int getMaxSleeping() {
>> return this.maxSleeping;
>> }
>>
>> @@ -114,7 +114,7 @@ public class StackObjectPoolFactory<T> i
>> * @param maxSleeping
>> * @since 2.0
>> */
>> - public synchronized void setMaxSleeping(int maxSleeping) {
>> + public void setMaxSleeping(int maxSleeping) {
>> this.maxSleeping = maxSleeping;
>> }
>>
>> @@ -124,7 +124,7 @@ public class StackObjectPoolFactory<T> i
>> * @return size of created containers (created pools are not pre-populated)
>> * @since 1.5.5
>> */
>> - public synchronized int getInitCapacity() {
>> + public int getInitCapacity() {
>> return this.initIdleCapacity;
>> }
>>
>> @@ -133,7 +133,7 @@ public class StackObjectPoolFactory<T> i
>> *
>> * @param initIdleCapacity size of created containers (created pools are not pre-populated)
>> */
>> - public synchronized void setInitCapacity(int initIdleCapacity) {
>> + public void setInitCapacity(int initIdleCapacity) {
>> this.initIdleCapacity = initIdleCapacity;
>> }
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org