Author: simonetripodi
Date: Sat Apr 23 15:49:19 2011
New Revision: 1096165

URL: http://svn.apache.org/viewvc?rev=1096165&view=rev
Log:
restored generics in the ObjectPool and related interfaces

Modified:
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java
    
commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPoolFactory.java
    
commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolableObjectFactory.java

Modified: 
commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java?rev=1096165&r1=1096164&r2=1096165&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java 
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java 
Sat Apr 23 15:49:19 2011
@@ -62,7 +62,7 @@ import java.util.NoSuchElementException;
  * @see BaseObjectPool
  * @since Pool 1.0
  */
-public interface ObjectPool {
+public interface ObjectPool<T> {
     /**
      * Obtains an instance from this pool.
      * <p>
@@ -88,7 +88,7 @@ public interface ObjectPool {
      * @throws Exception when {@link PoolableObjectFactory#makeObject 
makeObject} throws an exception.
      * @throws NoSuchElementException when the pool is exhausted and cannot or 
will not return another instance.
      */
-    Object borrowObject() throws Exception, NoSuchElementException, 
IllegalStateException;
+    T borrowObject() throws Exception, NoSuchElementException, 
IllegalStateException;
 
     /**
      * Return an instance to the pool.
@@ -100,7 +100,7 @@ public interface ObjectPool {
      * @param obj a {@link #borrowObject borrowed} instance to be returned.
      * @throws Exception 
      */
-    void returnObject(Object obj) throws Exception;
+    void returnObject(T obj) throws Exception;
 
     /**
      * <p>Invalidates an object from the pool.</p>
@@ -115,7 +115,7 @@ public interface ObjectPool {
      * @param obj a {@link #borrowObject borrowed} instance to be disposed.
      * @throws Exception
      */
-    void invalidateObject(Object obj) throws Exception;
+    void invalidateObject(T obj) throws Exception;
 
     /**
      * Create an object using the {@link PoolableObjectFactory factory} or 
other
@@ -186,5 +186,5 @@ public interface ObjectPool {
      * @throws UnsupportedOperationException if this implementation does not 
support the operation
      * @deprecated to be removed in pool 2.0
      */
-    void setFactory(PoolableObjectFactory factory) throws 
IllegalStateException, UnsupportedOperationException;
+    void setFactory(PoolableObjectFactory<T> factory) throws 
IllegalStateException, UnsupportedOperationException;
 }

Modified: 
commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPoolFactory.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPoolFactory.java?rev=1096165&r1=1096164&r2=1096165&view=diff
==============================================================================
--- 
commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPoolFactory.java
 (original)
+++ 
commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPoolFactory.java
 Sat Apr 23 15:49:19 2011
@@ -26,11 +26,11 @@ package org.apache.commons.pool;
  * @version $Revision$ $Date$
  * @since Pool 1.0
  */
-public interface ObjectPoolFactory {
+public interface ObjectPoolFactory<T> {
     /**
      * Create and return a new {@link ObjectPool}.
      * @return a new {@link ObjectPool}
      * @throws IllegalStateException when this pool factory is not configured 
properly
      */
-    ObjectPool createPool() throws IllegalStateException;
+    ObjectPool<T> createPool() throws IllegalStateException;
 }

Modified: 
commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolableObjectFactory.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolableObjectFactory.java?rev=1096165&r1=1096164&r2=1096165&view=diff
==============================================================================
--- 
commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolableObjectFactory.java
 (original)
+++ 
commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolableObjectFactory.java
 Sat Apr 23 15:49:19 2011
@@ -71,7 +71,7 @@ package org.apache.commons.pool;
  * @version $Revision$ $Date$
  * @since Pool 1.0
  */
-public interface PoolableObjectFactory {
+public interface PoolableObjectFactory<T> {
   /**
    * Creates an instance that can be served by the pool.
    * Instances returned from this method should be in the
@@ -83,7 +83,7 @@ public interface PoolableObjectFactory {
    * @throws Exception if there is a problem creating a new instance,
    *    this will be propagated to the code requesting an object.
    */
-  Object makeObject() throws Exception;
+  T makeObject() throws Exception;
 
   /**
    * Destroys an instance no longer needed by the pool.
@@ -104,7 +104,7 @@ public interface PoolableObjectFactory {
    * @see #validateObject
    * @see ObjectPool#invalidateObject
    */
-  void destroyObject(Object obj) throws Exception;
+  void destroyObject(T obj) throws Exception;
 
   /**
    * Ensures that the instance is safe to be returned by the pool.
@@ -114,7 +114,7 @@ public interface PoolableObjectFactory {
    * @return <code>false</code> if <code>obj</code> is not valid and should
    *         be dropped from the pool, <code>true</code> otherwise.
    */
-  boolean validateObject(Object obj);
+  boolean validateObject(T obj);
 
   /**
    * Reinitialize an instance to be returned by the pool.
@@ -124,7 +124,7 @@ public interface PoolableObjectFactory {
    *    this exception may be swallowed by the pool.
    * @see #destroyObject
    */
-  void activateObject(Object obj) throws Exception;
+  void activateObject(T obj) throws Exception;
 
   /**
    * Uninitialize an instance to be returned to the idle object pool.
@@ -134,5 +134,5 @@ public interface PoolableObjectFactory {
    *    this exception may be swallowed by the pool.
    * @see #destroyObject
    */
-  void passivateObject(Object obj) throws Exception;
+  void passivateObject(T obj) throws Exception;
 }


Reply via email to