Package eu.bandm.tools.message
Class MessageSync<M extends Message>
java.lang.Object
eu.bandm.tools.message.SingleSender<M>
eu.bandm.tools.message.MessageSync<M>
- All Implemented Interfaces:
MessageReceiver<M>
Can accept messages from many different parallel threads.
The public
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
receiver
-
Constructor Summary
ConstructorDescriptionMinimal constructor.MessageSync
(MessageReceiver<? super M> r) Constuctor setting the receiver. -
Method Summary
Methods inherited from class eu.bandm.tools.message.SingleSender
getReceiver, send, 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. Before using, the receiver must be set by the methods implemented in the superclass. -
MessageSync
Constuctor setting the receiver.
-
-
Method Details
-
receive
This 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.- Specified by:
receive
in interfaceMessageReceiver<M extends Message>
- Parameters:
m
- the message to receive.
-