Remove unnecessary sync block in ControllerMethodResolver

Closes gh-29208
This commit is contained in:
Adam Ostrožlík 2022-09-26 18:00:02 +02:00 committed by Brian Clozel
parent 0ccb64fe10
commit 641303baff
1 changed files with 1 additions and 11 deletions

View File

@ -372,17 +372,7 @@ class ControllerMethodResolver {
*/
public SessionAttributesHandler getSessionAttributesHandler(HandlerMethod handlerMethod) {
Class<?> handlerType = handlerMethod.getBeanType();
SessionAttributesHandler result = this.sessionAttributesHandlerCache.get(handlerType);
if (result == null) {
synchronized (this.sessionAttributesHandlerCache) {
result = this.sessionAttributesHandlerCache.get(handlerType);
if (result == null) {
result = new SessionAttributesHandler(handlerType);
this.sessionAttributesHandlerCache.put(handlerType, result);
}
}
}
return result;
return this.sessionAttributesHandlerCache.computeIfAbsent(handlerType, SessionAttributesHandler::new);
}
}