Author: simonetripodi
Date: Mon Dec 20 14:07:19 2010
New Revision: 1051110
URL: http://svn.apache.org/viewvc?rev=1051110&view=rev
Log:
removed the "reconfigure" methods
removed the useless default Config Builder static methods
Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPool.java
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPoolFactory.java
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolConfig.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/StackKeyedObjectPool.java
URL:
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPool.java?rev=1051110&r1=1051109&r2=1051110&view=diff
==============================================================================
---
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPool.java
(original)
+++
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPool.java
Mon Dec 20 14:07:19 2010
@@ -55,7 +55,7 @@ public class StackKeyedObjectPool<K,V> e
* @param factory the {...@link KeyedPoolableObjectFactory} used to
populate the pool
*/
public StackKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory) {
- this(factory,StackObjectPoolConfig.Builder.createDefaultConfig());
+ this(factory,new StackObjectPoolConfig.Builder().createConfig());
}
/**
@@ -70,22 +70,12 @@ public class StackKeyedObjectPool<K,V> e
if (factory == null) {
throw new IllegalArgumentException("factory must not be null");
}
- this.reconfigure(config);
- _factory = factory;
- _pools = new HashMap<K,Stack<V>>();
- _activeCount = new HashMap<K,Integer>();
- }
-
- /**
- * Allows reconfiguring the current StackObjectPoolFactory instance
- * without setting the parameters one by one.
- *
- * @param config the {...@link StackObjectPoolConfig} used to configure
the pool.
- */
- public synchronized final void reconfigure(StackObjectPoolConfig config) {
if (config == null) {
throw new IllegalArgumentException("config must not be null");
}
+ _factory = factory;
+ _pools = new HashMap<K,Stack<V>>();
+ _activeCount = new HashMap<K,Integer>();
this.maxSleeping = config.getMaxSleeping();
this.initIdleCapacity = config.getInitIdleCapacity();
}
Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPoolFactory.java
URL:
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPoolFactory.java?rev=1051110&r1=1051109&r2=1051110&view=diff
==============================================================================
---
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPoolFactory.java
(original)
+++
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackKeyedObjectPoolFactory.java
Mon Dec 20 14:07:19 2010
@@ -39,7 +39,7 @@ public class StackKeyedObjectPoolFactory
* @see
StackKeyedObjectPool#StackKeyedObjectPool(KeyedPoolableObjectFactory)
*/
public StackKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V>
factory) {
- this(factory,StackObjectPoolConfig.Builder.createDefaultConfig());
+ this(factory,new StackObjectPoolConfig.Builder().createConfig());
}
/**
@@ -53,20 +53,10 @@ public class StackKeyedObjectPoolFactory
if (factory == null) {
throw new IllegalArgumentException("factory must not be null");
}
- _factory = factory;
- this.reconfigure(config);
- }
-
- /**
- * Allows reconfiguring the current StackObjectPoolFactory instance
- * without setting the parameters one by one.
- *
- * @param config the {...@link StackObjectPoolConfig} used to configure
the pool.
- */
- public synchronized final void reconfigure(StackObjectPoolConfig config) {
if (config == null) {
throw new IllegalArgumentException("config must not be null");
}
+ _factory = factory;
this.maxSleeping = config.getMaxSleeping();
this.initIdleCapacity = config.getInitIdleCapacity();
}
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=1051110&r1=1051109&r2=1051110&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
Mon Dec 20 14:07:19 2010
@@ -51,7 +51,7 @@ public class StackObjectPool<T> extends
* @param factory the {...@link PoolableObjectFactory} used to populate
the pool
*/
public StackObjectPool(PoolableObjectFactory<T> factory) {
- this(factory,StackObjectPoolConfig.Builder.createDefaultConfig());
+ this(factory,new StackObjectPoolConfig.Builder().createConfig());
}
/**
@@ -62,21 +62,14 @@ public class StackObjectPool<T> extends
* @param config the {...@link StackObjectPoolConfig} used to configure
the pool.
*/
public StackObjectPool(PoolableObjectFactory<T> factory,
StackObjectPoolConfig config) {
- _factory = factory;
- _pool = new Stack<T>();
- this.reconfigure(config);
- }
-
- /**
- * Allows reconfiguring the current StackObjectPoolFactory instance
- * without setting the parameters one by one.
- *
- * @param config the {...@link StackObjectPoolConfig} used to configure
the pool.
- */
- public synchronized final void reconfigure(StackObjectPoolConfig config) {
+ if (factory == null) {
+ throw new IllegalArgumentException("factory must not be null");
+ }
if (config == null) {
throw new IllegalArgumentException("config must not be null");
}
+ _factory = factory;
+ _pool = new Stack<T>();
this.maxSleeping = config.getMaxSleeping();
_pool.ensureCapacity(config.getInitIdleCapacity() >
config.getMaxSleeping() ? config.getMaxSleeping() :
config.getInitIdleCapacity());
}
Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolConfig.java
URL:
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolConfig.java?rev=1051110&r1=1051109&r2=1051110&view=diff
==============================================================================
---
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolConfig.java
(original)
+++
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPoolConfig.java
Mon Dec 20 14:07:19 2010
@@ -119,15 +119,6 @@ public class StackObjectPoolConfig {
return new StackObjectPoolConfig(this.maxSleeping,
this.initIdleCapacity);
}
- /**
- * Creates a {...@link StackObjectPoolConfig} instance with default
values.
- *
- * @return a {...@link StackObjectPoolConfig} instance with default
values.
- */
- public static StackObjectPoolConfig createDefaultConfig() {
- return new Builder().createConfig();
- }
-
}
}
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=1051110&r1=1051109&r2=1051110&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
Mon Dec 20 14:07:19 2010
@@ -39,7 +39,7 @@ public class StackObjectPoolFactory<T> i
* @see StackObjectPool#StackObjectPool(PoolableObjectFactory)
*/
public StackObjectPoolFactory(PoolableObjectFactory<T> factory) {
- this(factory,StackObjectPoolConfig.Builder.createDefaultConfig());
+ this(factory,new StackObjectPoolConfig.Builder().createConfig());
}
/**
@@ -52,20 +52,10 @@ public class StackObjectPoolFactory<T> i
if (factory == null) {
throw new IllegalArgumentException("factory must not be null");
}
- this.reconfigure(config);
- _factory = factory;
- }
-
- /**
- * Allows reconfiguring the current StackObjectPoolFactory instance
- * without setting the parameters one by one.
- *
- * @param config the {...@link StackObjectPoolConfig} used to configure
the pool.
- */
- public synchronized final void reconfigure(StackObjectPoolConfig config) {
if (config == null) {
throw new IllegalArgumentException("config must not be null");
}
+ _factory = factory;
this.maxSleeping = config.getMaxSleeping();
this.initIdleCapacity = config.getInitIdleCapacity();
}