public interface MessageQueue
MessageQueue
represents a First-In-First-Out (FIFO)
persistent list of Message (source and target agent identifier,
notification).Modifier and Type | Method and Description |
---|---|
Message |
get()
Looks at the message at the top of this queue without removing
it from the queue.
|
Message |
get(long timeout)
Looks at the message at the top of this queue without removing
it from the queue.
|
void |
insert(Message item,
MessageComparator comparator)
Insert a message in the queue, it should only be used during
initialization for restoring the queue state.
|
Message |
pop()
Removes the message at the top of this queue.
|
void |
push(Message item)
Pushes a message onto the bottom of this queue.
|
void |
pushAndValidate(Message item)
Pushes a message and validates it at the same time.
|
String |
report()
Returns a report about the distribution of messages type in queue.
|
int |
size()
Returns the number of messages in this
MessageQueue
object. |
void |
validate()
Atomically validates all messages pushed in queue during a reaction.
|
void insert(Message item, MessageComparator comparator)
item
- the message to be pushed onto this queue.comparator
- the MessageComparator interface of MessageConsumer.void push(Message item)
item
- the message to be pushed onto this queue.void pushAndValidate(Message item)
item
- the message to be pushed and validatedMessage pop() throws EmptyQueueException
EmptyQueueException
- if this queue is empty.void validate()
Message get() throws InterruptedException
InterruptedException
- if another thread has interrupted the
current thread.Message get(long timeout) throws InterruptedException
timeout
- the maximum time to wait in milliseconds.InterruptedException
- if another thread has interrupted the
current thread.IllegalArgumentException
- if the value of timeout is negative.int size()
MessageQueue
object. Be careful, the result includes messages to be validated.String report()
Copyright © 2022 ScalAgent D.T.. All rights reserved.