@ThreadSafe
public interface BroadcastMessenger
Messenger for the broadcast (pub-sub type) communication between workers.
Implementations need to be thread-safe, as they are presented to possibly multi-threaded compute code.
Modifier and Type | Method and Description |
---|---|
<T extends java.io.Serializable> |
registerListener(BroadcastMessageListener<T> listener)
Registers a listener that will receive all incoming messages.
|
<T extends java.io.Serializable> |
removeListener(BroadcastMessageListener<T> listener)
Removes the listener.
|
<T extends java.io.Serializable> |
send(T message)
Sends the message to all neighbouring workers.
|
<T extends java.io.Serializable> void send(T message)
Sends the message to all neighbouring workers.
T
- a type of the payload.message
- a message to send.<T extends java.io.Serializable> void registerListener(BroadcastMessageListener<T> listener)
Registers a listener that will receive all incoming messages.
T
- a type of the payload.listener
- a listener to register.<T extends java.io.Serializable> void removeListener(BroadcastMessageListener<T> listener)
Removes the listener.
T
- a type of the payload.listener
- a listener to remove.