Adapt to Spring Framework convention for static cache field names
See gh-23345
This commit is contained in:
parent
5e61e33c66
commit
9929d75260
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -75,7 +75,8 @@ import org.springframework.util.ConcurrentReferenceHashMap;
|
|||
*/
|
||||
public abstract class ExtendedEntityManagerCreator {
|
||||
|
||||
private static final Map<Class<?>, Class[]> CACHED_ENTITY_MANAGER_INTERFACES = new ConcurrentReferenceHashMap<>();
|
||||
private static final Map<Class<?>, Class<?>[]> cachedEntityManagerInterfaces = new ConcurrentReferenceHashMap<>(4);
|
||||
|
||||
|
||||
/**
|
||||
* Create an application-managed extended EntityManager proxy.
|
||||
|
|
@ -226,10 +227,10 @@ public abstract class ExtendedEntityManagerCreator {
|
|||
boolean containerManaged, boolean synchronizedWithTransaction) {
|
||||
|
||||
Assert.notNull(rawEm, "EntityManager must not be null");
|
||||
Class[] interfaces;
|
||||
Class<?>[] interfaces;
|
||||
|
||||
if (emIfc != null) {
|
||||
interfaces = CACHED_ENTITY_MANAGER_INTERFACES.computeIfAbsent(emIfc, key -> {
|
||||
interfaces = cachedEntityManagerInterfaces.computeIfAbsent(emIfc, key -> {
|
||||
Set<Class<?>> ifcs = new LinkedHashSet<>();
|
||||
ifcs.add(key);
|
||||
ifcs.add(EntityManagerProxy.class);
|
||||
|
|
@ -237,7 +238,7 @@ public abstract class ExtendedEntityManagerCreator {
|
|||
});
|
||||
}
|
||||
else {
|
||||
interfaces = CACHED_ENTITY_MANAGER_INTERFACES.computeIfAbsent(rawEm.getClass(), key -> {
|
||||
interfaces = cachedEntityManagerInterfaces.computeIfAbsent(rawEm.getClass(), key -> {
|
||||
Set<Class<?>> ifcs = new LinkedHashSet<>();
|
||||
ifcs.addAll(ClassUtils
|
||||
.getAllInterfacesForClassAsSet(key, cl));
|
||||
|
|
|
|||
|
|
@ -71,12 +71,12 @@ public abstract class SharedEntityManagerCreator {
|
|||
|
||||
private static final Class<?>[] NO_ENTITY_MANAGER_INTERFACES = new Class<?>[0];
|
||||
|
||||
private static final Map<Class<?>, Class<?>[]> cachedQueryInterfaces = new ConcurrentReferenceHashMap<>(4);
|
||||
|
||||
private static final Set<String> transactionRequiringMethods = new HashSet<>(8);
|
||||
|
||||
private static final Set<String> queryTerminatingMethods = new HashSet<>(8);
|
||||
|
||||
private static final Map<Class<?>, Class[]> CACHED_QUERY_INTERFACES = new ConcurrentReferenceHashMap<>();
|
||||
|
||||
static {
|
||||
transactionRequiringMethods.add("joinTransaction");
|
||||
transactionRequiringMethods.add("flush");
|
||||
|
|
@ -314,7 +314,7 @@ public abstract class SharedEntityManagerCreator {
|
|||
if (result instanceof Query) {
|
||||
Query query = (Query) result;
|
||||
if (isNewEm) {
|
||||
Class<?>[] ifcs = CACHED_QUERY_INTERFACES.computeIfAbsent(query.getClass(), key ->
|
||||
Class<?>[] ifcs = cachedQueryInterfaces.computeIfAbsent(query.getClass(), key ->
|
||||
ClassUtils.getAllInterfacesForClass(key, this.proxyClassLoader));
|
||||
result = Proxy.newProxyInstance(this.proxyClassLoader, ifcs,
|
||||
new DeferredQueryInvocationHandler(query, target));
|
||||
|
|
|
|||
Loading…
Reference in New Issue