commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r900046 - /commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
Date Sun, 17 Jan 2010 01:40:55 GMT
Author: sebb
Date: Sun Jan 17 01:40:55 2010
New Revision: 900046

URL: http://svn.apache.org/viewvc?rev=900046&view=rev
Log:
DBCP-321 SharedPoolDataSource does not need userKeys LRUMap cache

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java?rev=900046&r1=900045&r2=900046&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
Sun Jan 17 01:40:55 2010
@@ -21,7 +21,6 @@
 import java.io.ObjectInputStream;
 import java.sql.Connection;
 import java.sql.SQLException;
-import java.util.Map;
 
 import javax.naming.NamingException;
 import javax.naming.Reference;
@@ -47,8 +46,6 @@
 
     private static final long serialVersionUID = -8132305535403690372L;
 
-    private final Map userKeys = new LRUMap(10);
-
     private int maxActive = GenericObjectPool.DEFAULT_MAX_ACTIVE;
     private int maxIdle = GenericObjectPool.DEFAULT_MAX_IDLE;
     private int maxWait = (int)Math.min(Integer.MAX_VALUE,
@@ -169,23 +166,11 @@
 
         PooledConnectionAndInfo info = null;
         
-        UserPassKey key = null;
-        synchronized (userKeys) {
-            key = getUserPassKey(username, password);
-        }
+        UserPassKey key = new UserPassKey(username, password);
         
         try {
             info = (PooledConnectionAndInfo) pool.borrowObject(key);
         }
-        catch (SQLException ex) {  // Remove bad UserPassKey
-            synchronized (userKeys) {
-                if (userKeys.containsKey(username)) {
-                    userKeys.remove(username);
-                }
-            }
-            throw new SQLNestedException(
-                    "Could not retrieve connection info from pool", ex);
-        }
         catch (Exception e) {
             throw new SQLNestedException(
                     "Could not retrieve connection info from pool", e);
@@ -205,16 +190,6 @@
         return ref;
     }
     
-    private UserPassKey getUserPassKey(String username, String password) {
-        String name = username + password;
-        UserPassKey key = (UserPassKey) userKeys.get(name);
-        if (key == null) {
-            key = new UserPassKey(username, password);
-            userKeys.put(name, key);
-        }
-        return key;
-    }
-
     private void registerPool(
         String username, String password) 
         throws javax.naming.NamingException, SQLException {



Mime
View raw message