#30996 fixed thread pinning issue. But only for SSEEmitter. Still there are several synchronized block in ResponseBodyEmitter.
|
public synchronized void send(Object object, @Nullable MediaType mediaType) throws IOException { |
|
public synchronized void send(Set<DataWithMediaType> items) throws IOException { |
To prevent thread pinning when using virtual thread, it have to replaced with ReentrantLock.
Many of us cannot move to JDK 24 yet (which reduces synchronized pinning), so we need a framework-level mitigation.
#30996 fixed thread pinning issue. But only for SSEEmitter. Still there are several synchronized block in ResponseBodyEmitter.
spring-framework/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitter.java
Line 183 in e5b58ef
spring-framework/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitter.java
Line 211 in e5b58ef
To prevent thread pinning when using virtual thread, it have to replaced with
ReentrantLock.Many of us cannot move to JDK 24 yet (which reduces synchronized pinning), so we need a framework-level mitigation.