Package eu.bandm.tools.message
Class MessageTee<M extends Message>
java.lang.Object
eu.bandm.tools.message.MessageTee<M>
- All Implemented Interfaces:
MessageReceiver<M>
Re-sends the message received sequentially to a multitude of
current drains.
The identical message object is sent to all receivers, so in most
use cases it should be treated read-only by subsequent processing in the drains.
For details see
For details see
receive(Message)
.-
Field Summary
Modifier and TypeFieldDescriptionprotected final List<MessageReceiver<? super M>>
List of all receivers. -
Constructor Summary
ConstructorDescriptionSimplest constructor.MessageTee
(MessageReceiver<? super M> drain1) Nonvararg specialization avoidsunchecked
warnings.MessageTee
(MessageReceiver<? super M>... drains) Internally callsadd(MessageReceiver)
, please see there.MessageTee
(MessageReceiver<? super M> drain1, MessageReceiver<? super M> drain2) Nonvararg specialization avoidsunchecked
warnings Internally callsadd(MessageReceiver)
, please see there.!MessageTee
(MessageReceiver<? super M> drain1, MessageReceiver<? super M> drain2, MessageReceiver<? super M> drain3) Nonvararg specialization avoidsunchecked
warnings. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(MessageReceiver<? super M> drain) Adds the message receiver at the end of the list of all current drains.final void
add
(MessageReceiver<? super M>... newdrains) Internally callsadd(MessageReceiver)
, please see there.void
add
(MessageReceiver<? super M> drain1, MessageReceiver<? super M> drain2) Nonvararg specialization avoidsunchecked
warnings.void
addAll
(Iterable<MessageReceiver<? super M>> newdrains) Internally callsadd(MessageReceiver)
, please see there.void
clear()
Clear the list of all drains.List<MessageReceiver<? super M>>
Return an unmodifiable list of all drains.void
Propagates the message received sequentially to a multitude of current drains.
If there is one or moreMessageThrower
s in the pipeline behind these drains, then additionally the message is thrown after all drains have been sent to.
(Any otherThrowable
is, of course, not intercepted!)
-
Field Details
-
drains
List of all receivers. The sequential order is respected when sending the message, but in most use cases should not be relevant.
-
-
Constructor Details
-
MessageTee
public MessageTee()Simplest constructor. -
MessageTee
Internally callsadd(MessageReceiver)
, please see there. -
MessageTee
Nonvararg specialization avoidsunchecked
warnings. Internally callsadd(MessageReceiver)
, please see there.! -
MessageTee
Nonvararg specialization avoidsunchecked
warnings Internally callsadd(MessageReceiver)
, please see there.! -
MessageTee
public MessageTee(MessageReceiver<? super M> drain1, MessageReceiver<? super M> drain2, MessageReceiver<? super M> drain3) Nonvararg specialization avoidsunchecked
warnings. Internally callsadd(MessageReceiver)
, please see there.!
-
-
Method Details
-
getDrains
Return an unmodifiable list of all drains. -
add
Adds the message receiver at the end of the list of all current drains. Cfreceive(Message)
. If it is already contained at some position in the list, it is first removed and then re-inserted at the end of the list. -
add
Nonvararg specialization avoidsunchecked
warnings. Internally callsadd(MessageReceiver)
, please see there. -
add
Internally callsadd(MessageReceiver)
, please see there. -
addAll
Internally callsadd(MessageReceiver)
, please see there. -
clear
public void clear()Clear the list of all drains. -
receive
Propagates the message received sequentially to a multitude of current drains.
If there is one or moreMessageThrower
s in the pipeline behind these drains, then additionally the message is thrown after all drains have been sent to.
(Any otherThrowable
is, of course, not intercepted!)- Specified by:
receive
in interfaceMessageReceiver<M extends Message>
-