public class SimpleMessageGroup extends Object implements MessageGroup
MessageStore
and group id.
The group will grow during its lifetime, when messages are add
ed to it.
This MessageGroup is thread safe.Constructor and Description |
---|
SimpleMessageGroup(Collection<? extends Message<?>> messages,
Object groupId) |
SimpleMessageGroup(Collection<? extends Message<?>> messages,
Object groupId,
long timestamp,
boolean complete) |
SimpleMessageGroup(Collection<Message<?>> internalStore,
Collection<? extends Message<?>> messages,
Object groupId,
long timestamp,
boolean complete,
boolean storePreLoaded) |
SimpleMessageGroup(MessageGroup messageGroup) |
SimpleMessageGroup(Object groupId) |
Modifier and Type | Method and Description |
---|---|
void |
add(Message<?> messageToAdd)
Add the message to this group.
|
boolean |
canAdd(Message<?> message)
Query if the message can be added.
|
void |
clear() |
void |
complete()
Complete the group.
|
boolean |
containsSequence(Integer sequence)
Return true if a message with this sequence number header exists in
the group.
|
Object |
getGroupId() |
long |
getLastModified() |
int |
getLastReleasedMessageSequenceNumber() |
Collection<Message<?>> |
getMessages()
Returns all available Messages from the group at the time of invocation
|
Message<?> |
getOne() |
int |
getSequenceSize() |
long |
getTimestamp() |
boolean |
isComplete() |
boolean |
remove(Message<?> message)
Remove the message from this group.
|
void |
setLastModified(long lastModified) |
void |
setLastReleasedMessageSequenceNumber(int sequenceNumber) |
int |
size() |
String |
toString() |
public SimpleMessageGroup(Object groupId)
public SimpleMessageGroup(Collection<? extends Message<?>> messages, Object groupId)
public SimpleMessageGroup(MessageGroup messageGroup)
public SimpleMessageGroup(Collection<? extends Message<?>> messages, Object groupId, long timestamp, boolean complete)
public SimpleMessageGroup(Collection<Message<?>> internalStore, Collection<? extends Message<?>> messages, Object groupId, long timestamp, boolean complete, boolean storePreLoaded)
public long getTimestamp()
getTimestamp
in interface MessageGroup
public void setLastModified(long lastModified)
setLastModified
in interface MessageGroup
public long getLastModified()
getLastModified
in interface MessageGroup
public boolean canAdd(Message<?> message)
MessageGroup
canAdd
in interface MessageGroup
message
- The message.public void add(Message<?> messageToAdd)
MessageGroup
add
in interface MessageGroup
messageToAdd
- the message to add.public boolean remove(Message<?> message)
MessageGroup
remove
in interface MessageGroup
message
- the message to remove.true
if a message was removed.public int getLastReleasedMessageSequenceNumber()
getLastReleasedMessageSequenceNumber
in interface MessageGroup
public Collection<Message<?>> getMessages()
MessageGroup
getMessages
in interface MessageGroup
public void setLastReleasedMessageSequenceNumber(int sequenceNumber)
setLastReleasedMessageSequenceNumber
in interface MessageGroup
public Object getGroupId()
getGroupId
in interface MessageGroup
public boolean isComplete()
isComplete
in interface MessageGroup
public void complete()
MessageGroup
complete
in interface MessageGroup
public int getSequenceSize()
getSequenceSize
in interface MessageGroup
public int size()
size
in interface MessageGroup
public Message<?> getOne()
getOne
in interface MessageGroup
public void clear()
clear
in interface MessageGroup
public boolean containsSequence(Integer sequence)
sequence
- the sequence number.