reta commented on a change in pull request #597: CXF-8149 Reduce 
synchronization in AbstractJXBProvider
URL: https://github.com/apache/cxf/pull/597#discussion_r346083173
 
 

 ##########
 File path: 
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
 ##########
 @@ -506,38 +505,41 @@ public JAXBContext getJAXBContext(Class<?> type, Type 
genericType) throws JAXBEx
             }
         }
 
-        synchronized (classContexts) {
-            JAXBContext context = classContexts.get(type);
-            if (context != null) {
-                return context;
-            }
+        JAXBContext context = classContexts.get(type);
+        if (context != null) {
+            return context;
         }
 
-        JAXBContext context = getPackageContext(type, genericType);
+        context = getPackageContext(type, genericType);
 
         return context != null ? context : getClassContext(type, genericType);
     }
     public JAXBContext getClassContext(Class<?> type) throws JAXBException {
         return getClassContext(type, type);
     }
     protected JAXBContext getClassContext(Class<?> type, Type genericType) 
throws JAXBException {
-        synchronized (classContexts) {
-            JAXBContext context = classContexts.get(type);
-            if (context == null) {
-                Class<?>[] classes;
-                if (extraClass != null) {
-                    classes = new Class[extraClass.length + 1];
-                    classes[0] = type;
-                    System.arraycopy(extraClass, 0, classes, 1, 
extraClass.length);
-                } else {
-                    classes = new Class[] {type};
-                }
+        final AtomicReference<JAXBException> jaxbException = new 
AtomicReference<>();
 
 Review comment:
   Since this is JAXB-related code, using `javax.xml.ws.Holder` would be more 
lightweight option I think

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to