SseEmitter
is guarding write operations to the response with a synchronized
block. As explained in JEP 245, this behavior can cause the current virtual thread to be pinned to the underlying platform thread during the write operation.
We should use instead a ReentrantLock
to prevent platform thread pinning on JDK 21 (if virtual threads are enabled).