Class InMemoryMessageTable

    • Constructor Detail

      • InMemoryMessageTable

        public InMemoryMessageTable()
    • Method Detail

      • getConsumedMemory

        public int getConsumedMemory()
        Description copied from interface: MessageTable
        Returns the amount of memory in bytes consumed by this message table.
        Specified by:
        getConsumedMemory in interface MessageTable
        Returns:
        amount of memory in bytes
      • put

        public void put​(Message msg)
        Description copied from interface: MessageTable
        Adds a message in this table.
        Specified by:
        put in interface MessageTable
        Parameters:
        msg - the message to be added
      • checkConsumedMemory

        public void checkConsumedMemory()
        Description copied from interface: MessageTable
        Checks whether the consumed memory is allowed and performs the appropriate actions.
        Specified by:
        checkConsumedMemory in interface MessageTable
      • get

        public Message get​(String msgId)
        Description copied from interface: MessageTable
        Returns the specified message.
        Specified by:
        get in interface MessageTable
        Parameters:
        msgId - the identifier of the message to return
        Returns:
        the specified message
      • clean

        public int clean​(long currentTime,
                         DMQManager dmqManager)
        Description copied from interface: MessageTable
        Cleans the table from invalid messages. The detected invalid messages should be removed from the table, deleted if necessary (if persistent), and added to the dead message queue manager. The number of messages to be checked depends on the implementation, i.e. all the messages from the table do not have to be checked.
        Specified by:
        clean in interface MessageTable
        Parameters:
        currentTime - the time from which messages are considered invalid
        dmqManager - the dead message queue manager
        Returns:
        the number of invalid messages
      • remove

        public void remove​(String msgId)
        Description copied from interface: MessageTable
        Removes the specified message.
        Specified by:
        remove in interface MessageTable
        Parameters:
        msgId - the identifier of the message to remove
      • size

        public int size()
        Description copied from interface: MessageTable
        Returns the exact number of all the messages that are contained by this table.
        Specified by:
        size in interface MessageTable
        Returns:
        the number of messages in this table
      • getMap

        public HashMap<String,​Message> getMap()
        Description copied from interface: MessageTable
        Returns a map of messages from this table indexed by their message identifiers. A subset of the messages may be returned depending on the implementation. All the messages from the table do not have to be returned.
        Specified by:
        getMap in interface MessageTable
        Returns:
        a map of messages from this table.