]
Steve Ebersole updated HHH-5824:
--------------------------------
Fix Version/s: 3.6.1
Poor multithread performance in SessionFactoryImpl.getQueryCache
method
-----------------------------------------------------------------------
Key: HHH-5824
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5824
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.6.0
Reporter: Alexey Romanchuk
Fix For: 3.6.1
Synchronize all access to Map is multithreading bottleneck. ConcurrentHashMap or write
syncronization can solve this issue.
Here it is how SessionFactoryImpl.getQueryCache can be implemented:
{code}
public QueryCache getQueryCache(String regionName) throws HibernateException {
if ( regionName == null ) {
return getQueryCache();
}
if ( !settings.isQueryCacheEnabled() ) {
return null;
}
QueryCache currentQueryCache = ( QueryCache ) queryCaches.get( regionName );
if ( currentQueryCache == null ) {
synchronized ( allCacheRegions ) {
currentQueryCache = ( QueryCache ) queryCaches.get( regionName );
if ( currentQueryCache == null ) {
currentQueryCache = settings.getQueryCacheFactory().getQueryCache( regionName,
updateTimestampsCache, settings, properties );
queryCaches.put( regionName, currentQueryCache );
allCacheRegions.put( currentQueryCache.getRegion().getName(),
currentQueryCache.getRegion() );
}
}
}
return currentQueryCache;
}
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: