You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2013/01/10 16:31:48 UTC
svn commit: r1431429 - in /commons/proper/pool/branches/POOL_1_X/src:
changes/changes.xml
java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
java/org/apache/commons/pool/impl/GenericObjectPool.java
Author: markt
Date: Thu Jan 10 15:31:48 2013
New Revision: 1431429
URL: http://svn.apache.org/viewvc?rev=1431429&view=rev
Log:
Fix POOL-226
Make GenericKeyedObjectPool.ObjectTimestampPair fields private and final.
Modified:
commons/proper/pool/branches/POOL_1_X/src/changes/changes.xml
commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
Modified: commons/proper/pool/branches/POOL_1_X/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/POOL_1_X/src/changes/changes.xml?rev=1431429&r1=1431428&r2=1431429&view=diff
==============================================================================
--- commons/proper/pool/branches/POOL_1_X/src/changes/changes.xml (original)
+++ commons/proper/pool/branches/POOL_1_X/src/changes/changes.xml Thu Jan 10 15:31:48 2013
@@ -43,6 +43,9 @@
not create minIdle instances only to have them immediately destroyed by
using maxIdle for minIdle in this case.
</action>
+ <action dev="markt" type="fix" issue="POOL-226">
+ Make GenericKeyedObjectPool.ObjectTimestampPair fields private and final.
+ </action>
</release>
<release version="1.6" date="2012-01-07" description="Adds generics and requires Java 5.">
<action dev="ggregory" type="add" issue="POOL-208">
Modified: commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java?rev=1431429&r1=1431428&r2=1431429&view=diff
==============================================================================
--- commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java (original)
+++ commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java Thu Jan 10 15:31:48 2013
@@ -818,7 +818,7 @@ public class GenericKeyedObjectPool<K, V
* <p>
* If the configured value of minIdle is greater than the configured value
* for maxIdle then the value of maxIdle will be used instead.
- *
+ *
* @param poolSize - The minimum size of the each keyed pool
* @since Pool 1.3
* @see #getMinIdle
@@ -837,7 +837,7 @@ public class GenericKeyedObjectPool<K, V
* <p>
* If the configured value of minIdle is greater than the configured value
* for maxIdle then the value of maxIdle will be used instead.
- *
+ *
* @return minimum size of the each keyed pool
* @since Pool 1.3
* @see #setTimeBetweenEvictionRunsMillis
@@ -2298,21 +2298,15 @@ public class GenericKeyedObjectPool<K, V
* This is also used by {@link GenericObjectPool}.
*/
static class ObjectTimestampPair<T> implements Comparable<T> {
- //CHECKSTYLE: stop VisibilityModifier
/**
* Object instance
- * @deprecated this field will be made private and final in version 2.0
*/
- @Deprecated
- T value;
+ private final T value;
/**
* timestamp
- * @deprecated this field will be made private and final in version 2.0
*/
- @Deprecated
- long tstamp;
- //CHECKSTYLE: resume VisibilityModifier
+ private final long tstamp;
/**
* Create a new ObjectTimestampPair using the given object and the current system time.
Modified: commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=1431429&r1=1431428&r2=1431429&view=diff
==============================================================================
--- commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericObjectPool.java (original)
+++ commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericObjectPool.java Thu Jan 10 15:31:48 2013
@@ -1213,22 +1213,22 @@ public class GenericObjectPool<T> extend
}
// activate & validate the object
try {
- _factory.activateObject(latch.getPair().value);
+ _factory.activateObject(latch.getPair().getValue());
if(_testOnBorrow &&
- !_factory.validateObject(latch.getPair().value)) {
+ !_factory.validateObject(latch.getPair().getValue())) {
throw new Exception("ValidateObject failed");
}
synchronized(this) {
_numInternalProcessing--;
_numActive++;
}
- return latch.getPair().value;
+ return latch.getPair().getValue();
}
catch (Throwable e) {
PoolUtils.checkRethrow(e);
// object cannot be activated or is invalid
try {
- _factory.destroyObject(latch.getPair().value);
+ _factory.destroyObject(latch.getPair().getValue());
} catch (Throwable e2) {
PoolUtils.checkRethrow(e2);
// cannot destroy broken object
@@ -1348,7 +1348,7 @@ public class GenericObjectPool<T> extend
private void destroy(Collection<ObjectTimestampPair<T>> c, PoolableObjectFactory<T> factory) {
for (Iterator<ObjectTimestampPair<T>> it = c.iterator(); it.hasNext();) {
try {
- factory.destroyObject(it.next().value);
+ factory.destroyObject(it.next().getValue());
} catch(Exception e) {
// ignore error, keep destroying the rest
} finally {
@@ -1593,7 +1593,7 @@ public class GenericObjectPool<T> extend
}
boolean removeObject = false;
- final long idleTimeMilis = System.currentTimeMillis() - pair.tstamp;
+ final long idleTimeMilis = System.currentTimeMillis() - pair.getTstamp();
if ((getMinEvictableIdleTimeMillis() > 0) &&
(idleTimeMilis > getMinEvictableIdleTimeMillis())) {
removeObject = true;
@@ -1605,17 +1605,17 @@ public class GenericObjectPool<T> extend
if(getTestWhileIdle() && !removeObject) {
boolean active = false;
try {
- _factory.activateObject(pair.value);
+ _factory.activateObject(pair.getValue());
active = true;
} catch(Exception e) {
removeObject=true;
}
if(active) {
- if(!_factory.validateObject(pair.value)) {
+ if(!_factory.validateObject(pair.getValue())) {
removeObject=true;
} else {
try {
- _factory.passivateObject(pair.value);
+ _factory.passivateObject(pair.getValue());
} catch(Exception e) {
removeObject=true;
}
@@ -1625,7 +1625,7 @@ public class GenericObjectPool<T> extend
if (removeObject) {
try {
- _factory.destroyObject(pair.value);
+ _factory.destroyObject(pair.getValue());
} catch(Exception e) {
// ignored
}
@@ -1751,7 +1751,7 @@ public class GenericObjectPool<T> extend
long time = System.currentTimeMillis();
while(it.hasNext()) {
ObjectTimestampPair<T> pair = it.next();
- buf.append("\t").append(pair.value).append("\t").append(time - pair.tstamp).append("\n");
+ buf.append("\t").append(pair.getValue()).append("\t").append(time - pair.getTstamp()).append("\n");
}
return buf.toString();
}