Package eu.bandm.tools.message
Class MessageSync<M extends Message>
java.lang.Object
eu.bandm.tools.message.SingleSender<M>
eu.bandm.tools.message.MessagePasser<M>
eu.bandm.tools.message.MessageSync<M>
- Type Parameters:
M
- the type of the messages
- All Implemented Interfaces:
MessageReceiver<M>
Can accept messages from many different parallel threads.
The public receive(Message)
method is declared
"synchronized
", so that a monitor is opened on each call.
A second call from a different thread
will wait until the first call has completed.
-
Field Summary
Fields inherited from class eu.bandm.tools.message.SingleSender
drain
-
Constructor Summary
ConstructorsConstructorDescriptionMinimal constructor.MessageSync
(@Opt MessageReceiver<? super M> r) Constuctor setting the drain. -
Method Summary
Methods inherited from class eu.bandm.tools.message.SingleSender
getDrain, getReceiver, send, setDrain, setReceiver
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.bandm.tools.message.MessageReceiver
ifSubcriticalThen, ifSubcriticalThen, ifSubcriticalThenElse
-
Constructor Details
-
MessageSync
public MessageSync()Minimal constructor. For that a message can be received, the drain must be set to a non-null value. -
MessageSync
Constuctor setting the drain. For that a message can be received, the drain must now or later be set to a non-null value.- Parameters:
r
- the drain of this filter
-
-
Method Details
-
receive
Central point of service. This method is declaredsynchronized
, so that a monitor is opened on each call. A second call from a different thread will wait until the first call has completed.- Specified by:
receive
in interfaceMessageReceiver<M extends Message>
- Overrides:
receive
in classMessagePasser<M extends Message>
- Parameters:
m
- the message to receive.
-