[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-5824) Poor multithread performance in SessionFactoryImpl.getQueryCache method
Steve Ebersole (JIRA)
noreply at atlassian.com
Mon Jan 10 11:50:05 EST 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list