]
Steve Ebersole resolved HHH-5824.
---------------------------------
Resolution: Fixed
Fix Version/s: 4.0.0.Alpha1
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: Improvement
Components: caching (L2)
Affects Versions: 3.6.0
Reporter: Alexey Romanchuk
Assignee: Steve Ebersole
Fix For: 4.0.0.Alpha1, 3.6.1
Time Spent: 0.8h
Remaining Estimate: 0h
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: