commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1096206 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2: BaseKeyedObjectPool.java BaseKeyedPoolableObjectFactory.java
Date Sat, 23 Apr 2011 18:43:58 GMT
Author: simonetripodi
Date: Sat Apr 23 18:43:57 2011
New Revision: 1096206

URL: http://svn.apache.org/viewvc?rev=1096206&view=rev
Log:
restored generics to BaseKeyedObjectPool (and related PoolableOjectFactory) class

Modified:
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedPoolableObjectFactory.java

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java?rev=1096206&r1=1096205&r2=1096206&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java Sat
Apr 23 18:43:57 2011
@@ -27,18 +27,17 @@ package org.apache.commons.pool2;
  * @version $Revision$ $Date$
  * @since Pool 1.0
  */
-public abstract class BaseKeyedObjectPool implements KeyedObjectPool {
-    
+public abstract class BaseKeyedObjectPool<K,V> implements KeyedObjectPool<K,V>
{
     /**
      * {@inheritDoc}
      */
-    public abstract Object borrowObject(Object key) throws Exception;
-    
+    public abstract V borrowObject(K key) throws Exception;
+
     /**
      * {@inheritDoc}
      */
-    public abstract void returnObject(Object key, Object obj) throws Exception;
-    
+    public abstract void returnObject(K key, V obj) throws Exception;
+
     /**
      * <p>Invalidates an object from the pool.</p>
      * 
@@ -53,7 +52,7 @@ public abstract class BaseKeyedObjectPoo
      * @param obj a {@link #borrowObject borrowed} instance to be returned.
      * @throws Exception 
      */
-    public abstract void invalidateObject(Object key, Object obj) throws Exception;
+    public abstract void invalidateObject(K key, V obj) throws Exception;
 
     /**
      * Not supported in this base implementation.
@@ -62,7 +61,7 @@ public abstract class BaseKeyedObjectPoo
      * @param key ignored
      * @throws UnsupportedOperationException
      */
-    public void addObject(Object key) throws Exception, UnsupportedOperationException {
+    public void addObject(K key) throws Exception, UnsupportedOperationException {
         throw new UnsupportedOperationException();
     }
 
@@ -71,7 +70,7 @@ public abstract class BaseKeyedObjectPoo
      * @return a negative value.
      * @param key ignored
      */
-    public int getNumIdle(Object key) throws UnsupportedOperationException {
+    public int getNumIdle(K key) throws UnsupportedOperationException {
         return -1;
     }
 
@@ -80,7 +79,7 @@ public abstract class BaseKeyedObjectPoo
      * @return a negative value.
      * @param key ignored
      */
-    public int getNumActive(Object key) throws UnsupportedOperationException {
+    public int getNumActive(K key) throws UnsupportedOperationException {
         return -1;
     }
 
@@ -113,7 +112,7 @@ public abstract class BaseKeyedObjectPoo
      * @param key ignored
      * @throws UnsupportedOperationException
      */
-    public void clear(Object key) throws Exception, UnsupportedOperationException {
+    public void clear(K key) throws Exception, UnsupportedOperationException {
         throw new UnsupportedOperationException();
     }
 
@@ -132,7 +131,7 @@ public abstract class BaseKeyedObjectPoo
      * @param factory the new KeyedPoolableObjectFactory
      * @deprecated to be removed in pool 2.0
      */
-    public void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException,
UnsupportedOperationException {
+    public void setFactory(KeyedPoolableObjectFactory<K,V> factory) throws IllegalStateException,
UnsupportedOperationException {
         throw new UnsupportedOperationException();
     }
 

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedPoolableObjectFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedPoolableObjectFactory.java?rev=1096206&r1=1096205&r2=1096206&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedPoolableObjectFactory.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedPoolableObjectFactory.java
Sat Apr 23 18:43:57 2011
@@ -29,14 +29,14 @@ package org.apache.commons.pool2;
  * @version $Revision$ $Date$
  * @since Pool 1.0
  */
-public abstract class BaseKeyedPoolableObjectFactory implements KeyedPoolableObjectFactory
{
+public abstract class BaseKeyedPoolableObjectFactory<K,V> implements KeyedPoolableObjectFactory<K,V>
{
     /**
      * Create an instance that can be served by the pool.
      *
      * @param key the key used when constructing the object
      * @return an instance that can be served by the pool
      */
-    public abstract Object makeObject(Object key)
+    public abstract V makeObject(K key)
         throws Exception;
 
     /**
@@ -48,7 +48,7 @@ public abstract class BaseKeyedPoolableO
      * @param key the key used when selecting the instance
      * @param obj the instance to be destroyed
      */
-    public void destroyObject(Object key, Object obj)
+    public void destroyObject(K key, V obj)
         throws Exception {
     }
 
@@ -62,7 +62,7 @@ public abstract class BaseKeyedPoolableO
      * @param obj the instance to be validated
      * @return always <code>true</code> in the default implementation
      */ 
-    public boolean validateObject(Object key, Object obj) {
+    public boolean validateObject(K key, V obj) {
         return true;
     }
 
@@ -75,7 +75,7 @@ public abstract class BaseKeyedPoolableO
      * @param key the key used when selecting the object
      * @param obj the instance to be activated
      */
-    public void activateObject(Object key, Object obj)
+    public void activateObject(K key, V obj)
         throws Exception {
     }
 
@@ -88,7 +88,7 @@ public abstract class BaseKeyedPoolableO
      * @param key the key used when selecting the object
      * @param obj the instance to be passivated
      */
-    public void passivateObject(Object key, Object obj)
+    public void passivateObject(K key, V obj)
         throws Exception {
     }
 }



Mime
View raw message