Class MessageAdmin


  • public class MessageAdmin
    extends Object
    Administration of messages.
    • Method Detail

      • getAdmin

        public static MessageAdmin getAdmin()
        Get the singleton MessageAdmin object
        Returns:
        singleton instance
      • putRequest

        public void putRequest​(String id,
                               Message request,
                               CountDownLatch latch)
        Store a request under the given id, so that an arriving reply can be associated with this request and the waiting party can be signaled by means of a CountDownLatch
        Parameters:
        id - id of the request
        request - request object to store under id
        latch - communication latch to signal when a reply for this request was received
      • putReply

        public void putReply​(String id,
                             Message reply)
        Try to associate a reply to a previously stored request. If a matching request is found, the owner of the request will be notified with the registered CountDownLatch
        Parameters:
        id - id of the request
        reply - object with the reply
      • get

        public Message get​(String id)
        Get the reply message.
        Parameters:
        id - the id of the message
        Returns:
        the received message or null