HHH-11516 : Level two cache may not be enabled when using @Cacheable without/instead of @Cache

(cherry picked from commit 7c870acc59913f16d35b609b31d7b0286fa2aee3)
This commit is contained in:
Gail Badner 2017-03-12 23:53:38 -07:00 committed by Gail Badner
parent f1abc98960
commit 3b754886f1
1 changed files with 3 additions and 8 deletions

View File

@ -1144,16 +1144,11 @@ public final class AnnotationBinder {
return new LocalCacheAnnotationImpl( region, determineCacheConcurrencyStrategy( context ) ); return new LocalCacheAnnotationImpl( region, determineCacheConcurrencyStrategy( context ) );
} }
private static CacheConcurrencyStrategy DEFAULT_CACHE_CONCURRENCY_STRATEGY;
private static CacheConcurrencyStrategy determineCacheConcurrencyStrategy(MetadataBuildingContext context) { private static CacheConcurrencyStrategy determineCacheConcurrencyStrategy(MetadataBuildingContext context) {
if ( DEFAULT_CACHE_CONCURRENCY_STRATEGY == null ) { return CacheConcurrencyStrategy.fromAccessType(
DEFAULT_CACHE_CONCURRENCY_STRATEGY = CacheConcurrencyStrategy.fromAccessType(
context.getBuildingOptions().getImplicitCacheAccessType() context.getBuildingOptions().getImplicitCacheAccessType()
); );
} }
return DEFAULT_CACHE_CONCURRENCY_STRATEGY;
}
@SuppressWarnings({ "ClassExplicitlyAnnotation" }) @SuppressWarnings({ "ClassExplicitlyAnnotation" })
private static class LocalCacheAnnotationImpl implements Cache { private static class LocalCacheAnnotationImpl implements Cache {