Package org.apache.activemq
Class ActiveMQMessageAuditNoSync
- java.lang.Object
-
- org.apache.activemq.ActiveMQMessageAuditNoSync
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ActiveMQMessageAudit
public class ActiveMQMessageAuditNoSync extends Object implements Serializable
Provides basic audit functions for Messages without sync- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_WINDOW_SIZE
static int
MAXIMUM_PRODUCER_COUNT
-
Constructor Summary
Constructors Constructor Description ActiveMQMessageAuditNoSync()
Default Constructor windowSize = 2048, maximumNumberOfProducersToTrack = 64ActiveMQMessageAuditNoSync(int auditDepth, int maximumNumberOfProducersToTrack)
Construct a MessageAudit
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
int
getAuditDepth()
long
getLastSeqId(ProducerId id)
int
getMaximumNumberOfProducersToTrack()
boolean
isDuplicate(String id)
checks whether this messageId has been seen before and adds this messageId to the listboolean
isDuplicate(Message message)
Checks if this message has been seen beforeboolean
isDuplicate(MessageReference message)
Checks if this message has been seen beforeboolean
isDuplicate(MessageId id)
Checks if this messageId has been seen beforeboolean
isInOrder(String id)
Check the message id is in orderboolean
isInOrder(Message msg)
Check the message is in orderboolean
isInOrder(MessageReference message)
Check the MessageId is in orderboolean
isInOrder(MessageId id)
Check the MessageId is in orderboolean
isModified()
Returns if the Audit has been modified since last check, this method does not reset the modified flag.boolean
modified()
Reads and returns the current modified state of the Audit, once called the state is reset to false.void
rollback(String id)
void
rollback(MessageReference message)
mark this message as being receivedvoid
rollback(MessageId id)
mark this message as being receivedvoid
setAuditDepth(int auditDepth)
void
setMaximumNumberOfProducersToTrack(int maximumNumberOfProducersToTrack)
void
setModified(boolean modified)
-
-
-
Field Detail
-
DEFAULT_WINDOW_SIZE
public static final int DEFAULT_WINDOW_SIZE
- See Also:
- Constant Field Values
-
MAXIMUM_PRODUCER_COUNT
public static final int MAXIMUM_PRODUCER_COUNT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ActiveMQMessageAuditNoSync
public ActiveMQMessageAuditNoSync()
Default Constructor windowSize = 2048, maximumNumberOfProducersToTrack = 64
-
ActiveMQMessageAuditNoSync
public ActiveMQMessageAuditNoSync(int auditDepth, int maximumNumberOfProducersToTrack)
Construct a MessageAudit- Parameters:
auditDepth
- range of ids to trackmaximumNumberOfProducersToTrack
- number of producers expected in the system
-
-
Method Detail
-
getAuditDepth
public int getAuditDepth()
- Returns:
- the auditDepth
-
setAuditDepth
public void setAuditDepth(int auditDepth)
- Parameters:
auditDepth
- the auditDepth to set
-
getMaximumNumberOfProducersToTrack
public int getMaximumNumberOfProducersToTrack()
- Returns:
- the maximumNumberOfProducersToTrack
-
setMaximumNumberOfProducersToTrack
public void setMaximumNumberOfProducersToTrack(int maximumNumberOfProducersToTrack)
- Parameters:
maximumNumberOfProducersToTrack
- the maximumNumberOfProducersToTrack to set
-
isDuplicate
public boolean isDuplicate(Message message) throws JMSException
Checks if this message has been seen before- Parameters:
message
-- Returns:
- true if the message is a duplicate
- Throws:
JMSException
-
isDuplicate
public boolean isDuplicate(String id)
checks whether this messageId has been seen before and adds this messageId to the list- Parameters:
id
-- Returns:
- true if the message is a duplicate
-
isDuplicate
public boolean isDuplicate(MessageReference message)
Checks if this message has been seen before- Parameters:
message
-- Returns:
- true if the message is a duplicate
-
isDuplicate
public boolean isDuplicate(MessageId id)
Checks if this messageId has been seen before- Parameters:
id
-- Returns:
- true if the message is a duplicate
-
rollback
public void rollback(MessageReference message)
mark this message as being received- Parameters:
message
-
-
rollback
public void rollback(MessageId id)
mark this message as being received- Parameters:
id
-
-
rollback
public void rollback(String id)
-
isInOrder
public boolean isInOrder(Message msg) throws JMSException
Check the message is in order- Parameters:
msg
-- Returns:
- true if the id is in order
- Throws:
JMSException
-
isInOrder
public boolean isInOrder(String id)
Check the message id is in order- Parameters:
id
-- Returns:
- true if the id is in order
-
isInOrder
public boolean isInOrder(MessageReference message)
Check the MessageId is in order- Parameters:
message
-- Returns:
- true if the id is in order
-
isInOrder
public boolean isInOrder(MessageId id)
Check the MessageId is in order- Parameters:
id
-- Returns:
- true if the id is in order
-
getLastSeqId
public long getLastSeqId(ProducerId id)
-
clear
public void clear()
-
isModified
public boolean isModified()
Returns if the Audit has been modified since last check, this method does not reset the modified flag. If the caller needs to reset the flag in order to avoid serializing an unchanged Audit then its up the them to reset it themselves.- Returns:
- true if the Audit has been modified.
-
setModified
public void setModified(boolean modified)
-
modified
public boolean modified()
Reads and returns the current modified state of the Audit, once called the state is reset to false. This method is useful for code the needs to know if it should write out the Audit or otherwise execute some logic based on the Audit having changed since last check.- Returns:
- true if the Audit has been modified since last check.
-
-