Class MessageLatch<M extends Message>

java.lang.Object
eu.bandm.tools.message.MessageLatch<M>
Type Parameters:
M - the message type.
All Implemented Interfaces:
MessageReceiver<M>

public class MessageLatch<M extends Message> extends Object implements MessageReceiver<M>
A simple register which save the most recenly received message.
  • Field Details

    • lastMessage

      @Opt M extends Message lastMessage
      Internal store for the last received message.
  • Constructor Details

    • MessageLatch

      public MessageLatch()
      Only constructor.
  • Method Details

    • receive

      public void receive(M m)
      Receive the given message. Store the message internally.
      Specified by:
      receive in interface MessageReceiver<M extends Message>
      Parameters:
      m - the message to receive.
    • getLastMessage

      @Opt public M getLastMessage()
      Return the last received message. Can be null only before the very first reception.
      Returns:
      the last received message.