-
Bug
-
Resolution: Done
-
Major
-
4.0.0.Beta1, 3.5.0.Final
The current SseBroadcasterImpl break following java doc requirements:
1.
Requirement from javax.ws.rs.sse.SseBroadcaster.close() doc:
Once the SseBroadcaster is closed, subsequent calls have no effect and are ignored. Once the SseBroadcaster is closed, invoking any other method on the broadcaster instance would result in an IllegalStateException being thrown
2.
Requirement from javax.ws.rs.sse.SseBroadcaster.onClose(Consumer<SseEventSink> onClose) doc:
We have to notify close listeners if the SSE event output has been
closed (either by client closing the connection (IOException) or
by calling SseEventSink.close() (IllegalStateException)
on the server side.
3.
Potential resource leak due to SseEventSink not closed when SseBroadCaster.close() is invoked:
Actually most of the time when a SseEventSink is registered to a SseBroadcaster, user is expected its termination to be handled by the SseBroadcaster itself. So user will never call SseEventSink.close() on each SseEventSink he registered but instead he will just call SseBroadcaster.close().
So SseBroadcasterImpl must be safe enough to ensure that calling SseBroadcasterImpl.close() will actually close all regsitered SseEventSink and to prevent any concurrent access to SseBroadcasterImpl.register that will add any new SseEventSink which will never be closed by the SseBroadcasterImpl.
- is related to
-
RESTEASY-1819 SseBroadcaster.onClose() is not called when SseEventSink is closed or after client connection is closed.
- Resolved