spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Remove unnecessary synchronization blocks on maps and refactor

Open Drezir opened this issue 3 years ago • 2 comments
trafficstars

Drezir avatar Sep 29 '22 15:09 Drezir

Nice refactor. I have one question: why are the synchronizations not needed?

Because the map is already thread friendly.

Drezir avatar Oct 07 '22 15:10 Drezir

Nice refactor. I have one question: why are the synchronizations not needed?

Because the map is already thread friendly.

Indeed the cacheMap is a ConcurrentHashMap and is thread safe.

valituguran avatar Oct 07 '22 16:10 valituguran

Thanks but I'd rather keep the code as it is now, an in particular for anything that's not a straightforward object creation within the lambda bloc.

snicoll avatar Aug 27 '23 15:08 snicoll