Package com.suse.salt.netapi.event
Interface EventStream
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AbstractEventStream,WebSocketEventStream
public interface EventStream extends AutoCloseable
Represents a container of listener toEvent; for each message a bunch ofEventListenerwill be recalled and notified with it.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddEventListener(EventListener listener)Adds a listener.voidclose()Closes this Stream; Events will not be posted to listeners after this call.intgetListenerCount()Helper method that returns the current number of subscribed listeners.booleanisEventStreamClosed()Helper method to check if the stream is able to receive Events.voidremoveEventListener(EventListener listener)Removes a listener.
-
-
-
Method Detail
-
addEventListener
void addEventListener(EventListener listener)
Adds a listener.- Parameters:
listener- Reference to the class that implementsEventListener.
-
removeEventListener
void removeEventListener(EventListener listener)
Removes a listener.- Parameters:
listener- Reference to the class that implementsEventListener.
-
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 IOExceptionCloses this Stream; Events will not be posted to listeners after this call.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- in case of an error when closing the session
-
-