mirror of https://github.com/apache/openjpa.git
OPENJPA-2609: Sporadic ClassCastException occurs under heavy load when QuerySQLCache is enabled.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.1.x@1709309 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
42855b69f4
commit
2073783505
|
@ -108,13 +108,20 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache {
|
|||
/**
|
||||
* Cache the given query keyed by its identifier. Does not cache if the
|
||||
* identifier matches any exclusion pattern or has been marked as
|
||||
* non-cachable. Also register the identifier as not cachable against
|
||||
* the matched exclusion pattern.
|
||||
* non-cachable. Also register the identifier as not cachable against the
|
||||
* matched exclusion pattern.
|
||||
*/
|
||||
public boolean cache(PreparedQuery q) {
|
||||
lock(false);
|
||||
try {
|
||||
String id = q.getIdentifier();
|
||||
|
||||
// OPENJPA-2609: Make sure another thread didn't add the 'id'
|
||||
// while holding the 'lock'.
|
||||
if (_delegate.containsKey(id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Boolean.FALSE.equals(isCachable(id))) {
|
||||
if (_log != null && _log.isTraceEnabled())
|
||||
_log.trace(_loc.get("prepared-query-not-cachable", id));
|
||||
|
|
Loading…
Reference in New Issue