commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1100159 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: GenericKeyedObjectPool.java GenericObjectPool.java
Date Fri, 06 May 2011 10:19:49 GMT
Author: markt
Date: Fri May  6 10:19:49 2011
New Revision: 1100159

URL: http://svn.apache.org/viewvc?rev=1100159&view=rev
Log:
Fix various Eclipse warnings prior to re-writing the core object allocation code

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=1100159&r1=1100158&r2=1100159&view=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 May  6 10:19:49 2011
@@ -30,7 +30,6 @@ import java.util.TimerTask;
 import java.util.TreeMap;
 
 import org.apache.commons.pool2.BaseKeyedObjectPool;
-import org.apache.commons.pool2.KeyedObjectPool;
 import org.apache.commons.pool2.KeyedPoolableObjectFactory;
 import org.apache.commons.pool2.PoolUtils;
 
@@ -204,7 +203,7 @@ import org.apache.commons.pool2.PoolUtil
  * @version $Revision$ $Date$
  * @since Pool 1.0
  */
-public class GenericKeyedObjectPool<K,V> extends BaseKeyedObjectPool<K,V> implements
KeyedObjectPool<K,V> {
+public class GenericKeyedObjectPool<K,V> extends BaseKeyedObjectPool<K,V>  {
 
     //--- public constants -------------------------------------------
 
@@ -1815,6 +1814,7 @@ public class GenericKeyedObjectPool<K,V>
      * @throws IllegalStateException if there are active (checked out) instances associated
with this keyed object pool
      * @deprecated to be removed in version 2.0
      */
+    @Override
     @Deprecated
     public void setFactory(KeyedPoolableObjectFactory<K,V> factory) throws IllegalStateException
{
         Map<K,List<ObjectTimestampPair<V>>> toDestroy = new HashMap<K,
List<ObjectTimestampPair<V>>>();
@@ -2254,19 +2254,15 @@ public class GenericKeyedObjectPool<K,V>
      * This is also used by {@link GenericObjectPool}.
      */
     static class ObjectTimestampPair<V> implements Comparable<ObjectTimestampPair<V>>
{
-        //CHECKSTYLE: stop VisibilityModifier
         /** 
          * Object instance 
-         * @deprecated this field will be made private and final in version 2.0
          */
-        V value;
+        private final V value;
         
         /**
          * timestamp
-         * @deprecated this field will be made private and final in version 2.0
          */
-        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/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=1100159&r1=1100158&r2=1100159&view=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
Fri May  6 10:19:49 2011
@@ -189,7 +189,7 @@ import org.apache.commons.pool2.impl.Gen
  * @version $Revision$ $Date$
  * @since Pool 1.0
  */
-public class GenericObjectPool<T> extends BaseObjectPool<T> implements ObjectPool<T>
{
+public class GenericObjectPool<T> extends BaseObjectPool<T> {
 
     //--- public constants -------------------------------------------
 
@@ -1197,22 +1197,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
@@ -1505,6 +1505,7 @@ public class GenericObjectPool<T> extend
      * @throws IllegalStateException when the factory cannot be set at this time
      * @deprecated to be removed in version 2.0
      */
+    @Override
     @Deprecated
     public void setFactory(PoolableObjectFactory<T> factory) throws IllegalStateException
{
         List<ObjectTimestampPair<T>> toDestroy = new ArrayList<ObjectTimestampPair<T>>();
@@ -1565,7 +1566,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;
@@ -1577,17 +1578,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;
                         }
@@ -1597,7 +1598,7 @@ public class GenericObjectPool<T> extend
 
             if (removeObject) {
                 try {
-                    _factory.destroyObject(pair.value);
+                    _factory.destroyObject(pair.getValue());
                 } catch(Exception e) {
                     // ignored
                 }



Mime
View raw message