[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4959) Concurrent HQL parsing blocks on ReflectHelper.classForName()

Lukáš Brožovský (JIRA) noreply at atlassian.com
Mon Aug 16 10:42:41 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=38091#action_38091 ] 

Lukáš Brožovský commented on HHH-4959:
--------------------------------------

Use ConcurrentHashMap instead of plain HashMap perhaps?

> Concurrent HQL parsing blocks on ReflectHelper.classForName()
> -------------------------------------------------------------
>
>                 Key: HHH-4959
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4959
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: query-hql
>    Affects Versions: 3.3.2
>         Environment: DB2
>            Reporter: Jarl Totland
>            Priority: Minor
>         Attachments: ReflectHelper.java
>
>
> For particularly HQL-heavy applications, concurrency is lost as ReflectHelper.classForName() blithely runs loadClass() for tokens again and again, many of which are not even classes. As loadClass() is synchronized it end up blocking while it generates stacktraces for its exceptions. This goes for both classic and AST parsers.
> Because of this blocking our regression tests took over 20 minutes, regardless of number of threads.
> Implementing a simple cache from String to Class in ReflectHelper.classForName() reduced this to 3 minutes for eight threads on a dual-core cpu; the bottleneck is now the database as it should be, not lock contention.
> The issue was reported earlier in HHH-1810, but dismissed as related to the classic parser only.
> We might use HQL in inappropriate ways, but still wouldn't hurt for Hibernate to support this.
> Attached is our modified ReflectHelper; modified code is in the classForName()-methods, classForNameInternal(), and the static HashMap<String, Object> classes.

-- 
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