|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2018 the original author or authors. |
| 2 | + * Copyright 2002-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
75 | 75 | */
|
76 | 76 | public abstract class ExtendedEntityManagerCreator {
|
77 | 77 |
|
78 |
| - private static final Map<Class<?>, Class[]> CACHED_ENTITY_MANAGER_INTERFACES = new ConcurrentReferenceHashMap<>(); |
| 78 | + private static final Map<Class<?>, Class<?>[]> cachedEntityManagerInterfaces = new ConcurrentReferenceHashMap<>(4); |
| 79 | + |
79 | 80 |
|
80 | 81 | /**
|
81 | 82 | * Create an application-managed extended EntityManager proxy.
|
@@ -226,18 +227,18 @@ private static EntityManager createProxy(
|
226 | 227 | boolean containerManaged, boolean synchronizedWithTransaction) {
|
227 | 228 |
|
228 | 229 | Assert.notNull(rawEm, "EntityManager must not be null");
|
229 |
| - Class[] interfaces; |
| 230 | + Class<?>[] interfaces; |
230 | 231 |
|
231 | 232 | if (emIfc != null) {
|
232 |
| - interfaces = CACHED_ENTITY_MANAGER_INTERFACES.computeIfAbsent(emIfc, key -> { |
| 233 | + interfaces = cachedEntityManagerInterfaces.computeIfAbsent(emIfc, key -> { |
233 | 234 | Set<Class<?>> ifcs = new LinkedHashSet<>();
|
234 | 235 | ifcs.add(key);
|
235 | 236 | ifcs.add(EntityManagerProxy.class);
|
236 | 237 | return ClassUtils.toClassArray(ifcs);
|
237 | 238 | });
|
238 | 239 | }
|
239 | 240 | else {
|
240 |
| - interfaces = CACHED_ENTITY_MANAGER_INTERFACES.computeIfAbsent(rawEm.getClass(), key -> { |
| 241 | + interfaces = cachedEntityManagerInterfaces.computeIfAbsent(rawEm.getClass(), key -> { |
241 | 242 | Set<Class<?>> ifcs = new LinkedHashSet<>();
|
242 | 243 | ifcs.addAll(ClassUtils
|
243 | 244 | .getAllInterfacesForClassAsSet(key, cl));
|
|
0 commit comments