Interface EventStream

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    AbstractEventStream, WebSocketEventStream

    public interface EventStream
    extends java.lang.AutoCloseable
    Represents a container of listener to Event; for each message a bunch of EventListener will be recalled and notified with it.
    • Method Detail

      • addEventListener

        void addEventListener​(EventListener listener)
        Adds a listener.
        Parameters:
        listener - Reference to the class that implements EventListener.
      • removeEventListener

        void removeEventListener​(EventListener listener)
        Removes a listener.
        Parameters:
        listener - Reference to the class that implements EventListener.
      • getListenerCount

        int getListenerCount()
        Helper method that returns the current number of subscribed listeners.
        Returns:
        The current number listeners.
      • isEventStreamClosed

        boolean isEventStreamClosed()
        Helper method to check if the stream is able to receive Events.
        Returns:
        A flag indicating the Stream state.
      • close

        void close()
            throws java.io.IOException
        Closes this Stream; Events will not be posted to listeners after this call.
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.io.IOException - in case of an error when closing the session