Package org.objectweb.joram.mom.util
Class InMemoryMessageTable
- java.lang.Object
-
- org.objectweb.joram.mom.util.InMemoryMessageTable
-
- All Implemented Interfaces:
MessageTable
public class InMemoryMessageTable extends Object implements MessageTable
-
-
Constructor Summary
Constructors Constructor Description InMemoryMessageTable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckConsumedMemory()Checks whether the consumed memory is allowed and performs the appropriate actions.intclean(long currentTime, DMQManager dmqManager)Cleans the table from invalid messages.Messageget(String msgId)Returns the specified message.intgetConsumedMemory()Returns the amount of memory in bytes consumed by this message table.HashMap<String,Message>getMap()Returns a map of messages from this table indexed by their message identifiers.voidput(Message msg)Adds a message in this table.voidremove(String msgId)Removes the specified message.intsize()Returns the exact number of all the messages that are contained by this table.
-
-
-
Method Detail
-
getConsumedMemory
public int getConsumedMemory()
Description copied from interface:MessageTableReturns the amount of memory in bytes consumed by this message table.- Specified by:
getConsumedMemoryin interfaceMessageTable- Returns:
- amount of memory in bytes
-
put
public void put(Message msg)
Description copied from interface:MessageTableAdds a message in this table.- Specified by:
putin interfaceMessageTable- Parameters:
msg- the message to be added
-
checkConsumedMemory
public void checkConsumedMemory()
Description copied from interface:MessageTableChecks whether the consumed memory is allowed and performs the appropriate actions.- Specified by:
checkConsumedMemoryin interfaceMessageTable
-
get
public Message get(String msgId)
Description copied from interface:MessageTableReturns the specified message.- Specified by:
getin interfaceMessageTable- 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:MessageTableCleans 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:
cleanin interfaceMessageTable- Parameters:
currentTime- the time from which messages are considered invaliddmqManager- the dead message queue manager- Returns:
- the number of invalid messages
-
remove
public void remove(String msgId)
Description copied from interface:MessageTableRemoves the specified message.- Specified by:
removein interfaceMessageTable- Parameters:
msgId- the identifier of the message to remove
-
size
public int size()
Description copied from interface:MessageTableReturns the exact number of all the messages that are contained by this table.- Specified by:
sizein interfaceMessageTable- Returns:
- the number of messages in this table
-
getMap
public HashMap<String,Message> getMap()
Description copied from interface:MessageTableReturns 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:
getMapin interfaceMessageTable- Returns:
- a map of messages from this table.
-
-