This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/3.3.x-fixes by this push:
new 87bd1eb CXF-8290 - Don't lock by default in
org.apache.cxf.jaxrs.model.AbstractResourceInfo#getProxyMap (#675)
87bd1eb is described below
commit 87bd1ebc69091f8f2fa61926a1e2c2cd8df01ed5
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Fri May 29 12:48:38 2020 +0100
CXF-8290 - Don't lock by default in
org.apache.cxf.jaxrs.model.AbstractResourceInfo#getProxyMap (#675)
(cherry picked from commit e7cd4c11e8cf8f3ddc08cd0dfa218091a52d2f97)
---
.../main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
index 106aea6..595e0c8 100644
---
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
+++
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
@@ -177,6 +177,13 @@ public abstract class AbstractResourceInfo {
@SuppressWarnings("unchecked")
private <T> Map<Class<?>, Map<T, ThreadLocalProxy<?>>> getProxyMap(String
prop, boolean create) {
+ // Avoid synchronizing on the bus for a ConcurrentHashMAp
+ if (bus.getProperties() instanceof ConcurrentHashMap) {
+ return (Map<Class<?>, Map<T, ThreadLocalProxy<?>>>)
bus.getProperties().computeIfAbsent(prop, k ->
+ new ConcurrentHashMap<Class<?>, Map<T, ThreadLocalProxy<?>>>(2)
+ );
+ }
+
Object property = null;
synchronized (bus) {
property = bus.getProperty(prop);