Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1793

SseBroadcasterImpl does not follow the javadoc requirements

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-ema Jim Ma
              nicones Nicolas NESMON
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: