reta commented on code in PR #3788:
URL: https://github.com/apache/cxf/pull/3788#discussion_r4707690433


##########
core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java:
##########
@@ -183,7 +183,10 @@ public static XMLInputFactory getXMLInputFactory(Message 
m) {
 
                 try {
                     xif = 
(XMLInputFactory)(cls.getDeclaredConstructor().newInstance());
-                    factories.put(o, xif);
+                    XMLInputFactory existing = FACTORIES.putIfAbsent(o, xif);

Review Comment:
   May be `computeIfAbsent` would more efficient (no need to create a new 
instance if `XMLInputFactory` is already cached:
   
   ```suggestion
                       xif = FACTORIES.computeIfAbsent(o, () -> 
(XMLInputFactory)(cls.getDeclaredConstructor().newInstance()));
   ```
   
   (would need a bit more elaborate exception handling though)



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to