public class InMemoryMessageTable extends Object implements MessageTable
Modifier and Type | Field and Description |
---|---|
static org.objectweb.util.monolog.api.Logger |
logger |
private HashMap<String,Message> |
map |
Constructor and Description |
---|
InMemoryMessageTable() |
Modifier and Type | Method and Description |
---|---|
void |
checkConsumedMemory()
Checks whether the consumed memory
is allowed and performs the
appropriate actions.
|
int |
clean(long currentTime,
DMQManager dmqManager)
Cleans the table from invalid
messages.
|
Message |
get(String msgId)
Returns the specified message.
|
int |
getConsumedMemory()
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.
|
void |
put(Message msg)
Adds a message in this table.
|
void |
remove(String msgId)
Removes the specified message.
|
int |
size()
Returns the exact number of all the messages
that are contained by this table.
|
public int getConsumedMemory()
MessageTable
getConsumedMemory
in interface MessageTable
public void put(Message msg)
MessageTable
put
in interface MessageTable
msg
- the message to be addedpublic void checkConsumedMemory()
MessageTable
checkConsumedMemory
in interface MessageTable
public Message get(String msgId)
MessageTable
get
in interface MessageTable
msgId
- the identifier of the message to returnpublic int clean(long currentTime, DMQManager dmqManager)
MessageTable
clean
in interface MessageTable
currentTime
- the time from which messages are considered invaliddmqManager
- the dead message queue managerpublic void remove(String msgId)
MessageTable
remove
in interface MessageTable
msgId
- the identifier of the message to removepublic int size()
MessageTable
size
in interface MessageTable
public HashMap<String,Message> getMap()
MessageTable
getMap
in interface MessageTable
Copyright © 2021 ScalAgent D.T.. All rights reserved.