commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1562988 - in /commons/proper/dbcp/trunk/src: changes/changes.xml main/java/org/apache/commons/dbcp2/datasources/InstanceKeyObjectFactory.java
Date Thu, 30 Jan 2014 21:39:51 GMT
Author: markt
Date: Thu Jan 30 21:39:51 2014
New Revision: 1562988

URL: http://svn.apache.org/r1562988
Log:
Fix DBCP-369
Fix threading issue when using multiple instances of the SharedPoolDataSource concurrently.
I can't reproduce this but the issue can be seeing from looking at the code.

Modified:
    commons/proper/dbcp/trunk/src/changes/changes.xml
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyObjectFactory.java

Modified: commons/proper/dbcp/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/changes/changes.xml?rev=1562988&r1=1562987&r2=1562988&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/changes/changes.xml (original)
+++ commons/proper/dbcp/trunk/src/changes/changes.xml Thu Jan 30 21:39:51 2014
@@ -95,6 +95,10 @@ The <action> type attribute can be add,u
         Allow accessToUnderlyingConnectionAllowed to be configured when
         configuration takes place via JNDI in a JavaEE container.
       </action>
+      <action dev="markt" issue="DBCP-369" type="fix" due-to="Michael Pradel">
+        Fix threading issue when using multiple instances of the
+        SharedPoolDataSource concurrently.
+      </action>
     </release>
     <release version="1.5.1" date="TBD" description="TBD">
       <action dev="markt" issue="DBCP-400" type="fix">

Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyObjectFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyObjectFactory.java?rev=1562988&r1=1562987&r2=1562988&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyObjectFactory.java
(original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyObjectFactory.java
Thu Jan 30 21:39:51 2014
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.commons.dbcp2.datasources;
 
 import java.io.ByteArrayInputStream;
@@ -23,10 +22,10 @@ import java.io.ObjectInputStream;
 
 import java.util.Hashtable;
 import java.util.Map;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map.Entry;
 import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.naming.Context;
 import javax.naming.Name;
@@ -40,11 +39,10 @@ import javax.naming.spi.ObjectFactory;
  *
  * @version $Revision$ $Date$
  */
-abstract class InstanceKeyObjectFactory
-    implements ObjectFactory
-{
+abstract class InstanceKeyObjectFactory implements ObjectFactory {
+
     private static final Map<String, InstanceKeyDataSource> instanceMap =
-            new HashMap<>();
+            new ConcurrentHashMap<>();
 
     synchronized static String registerNewInstance(InstanceKeyDataSource ds) {
         int max = 0;



Mime
View raw message