]
Jarl Totland commented on HHH-4959:
-----------------------------------
Yes, ConcurrentHashMap is obviously needed, though we ran heavy loads for a week or two
before it first failed. Apologies for not updating the attached class.
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: