HashMapPublisher

Publisher implementation using a HashMap of subscribers.

trait Publisher
class Object
trait Matchable
class Any

Value members

Concrete methods

override
def doPublish(evt: Event): Unit

Publishes an event into the stream.

Publishes an event into the stream.

Sends the event to all subscribers in the HashMap.

Definition Classes
override
def stopStream(): Unit

Performs any cleaning up required when the stream is finished.

Performs any cleaning up required when the stream is finished.

Notifies all subscribers that the stream is done and clears the HashMap to prevent any further events being delivered.

Definition Classes
override
def subscribe(subscriber: EventHandler): Unit

Subscribes an EventHandler to the stream so they can receive events.

Subscribes an EventHandler to the stream so they can receive events.

Adds the subscriber to the HashMap and calls its onInit method.

Definition Classes
override
def unsubscribe(subscriber: EventHandler): Unit

Unsubscribes an EventHandler to the stream so they can stop receiving events.

Unsubscribes an EventHandler to the stream so they can stop receiving events.

Removes the subscriber from the HashMap.

Definition Classes

Inherited methods

def isFinalEvent(e: Event): Boolean

Checks if an event signifies the end of the stream.

Checks if an event signifies the end of the stream.

Value Params
e

The event to check.

Returns

true if it is a final event.

Inherited from
Publisher
def publish(evt: Event): Unit

Wrapper method for doPublish that also stops the stream upon final events.

Wrapper method for doPublish that also stops the stream upon final events.

Inherited from
Publisher

Concrete fields

val subscribers: HashMap[UUID, EventHandler]

The HashMap of subscribers that receive events.

The HashMap of subscribers that receive events.