From 1c0b5510557e31c608610b83584e32c6bf8b6d28 Mon Sep 17 00:00:00 2001 From: Nikolay Shestakov Date: Sat, 29 Dec 2012 00:13:50 +0600 Subject: [PATCH] using ConcurrentHashMap for decrease synchronization --- .../org/hibernate/context/internal/JTASessionContext.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/context/internal/JTASessionContext.java b/hibernate-core/src/main/java/org/hibernate/context/internal/JTASessionContext.java index f33a7e2502..997732f133 100644 --- a/hibernate-core/src/main/java/org/hibernate/context/internal/JTASessionContext.java +++ b/hibernate-core/src/main/java/org/hibernate/context/internal/JTASessionContext.java @@ -23,8 +23,9 @@ */ package org.hibernate.context.internal; -import java.util.Hashtable; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + import javax.transaction.Synchronization; import javax.transaction.Transaction; import javax.transaction.TransactionManager; @@ -67,7 +68,7 @@ import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; public class JTASessionContext extends AbstractCurrentSessionContext { private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, JTASessionContext.class.getName()); - private transient Map currentSessionMap = new Hashtable(); + private transient Map currentSessionMap = new ConcurrentHashMap(); public JTASessionContext(SessionFactoryImplementor factory) { super( factory ); @@ -103,7 +104,7 @@ public class JTASessionContext extends AbstractCurrentSessionContext { final Object txnIdentifier = jtaPlatform.getTransactionIdentifier( txn ); - Session currentSession = ( Session ) currentSessionMap.get( txnIdentifier ); + Session currentSession = currentSessionMap.get( txnIdentifier ); if ( currentSession == null ) { currentSession = buildOrObtainSession();