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>

public class MessageSync<M extends Message> extends SingleSender<M> implements 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.
  • Constructor Details

    • MessageSync

      public MessageSync()
      Minimal constructor. Before using, the receiver must be set by the methods implemented in the superclass.
    • MessageSync

      public MessageSync(MessageReceiver<? super M> r)
      Constuctor setting the receiver.
  • Method Details

    • receive

      public void receive(M m)
      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 interface MessageReceiver<M extends Message>