org.jboss.mq.server
Class MessageReference

java.lang.Object
  extended byorg.jboss.mq.server.MessageReference
All Implemented Interfaces:
java.lang.Comparable

public class MessageReference
extends java.lang.Object
implements java.lang.Comparable

This class holds a reference to an actual Message. Where it is actually at may vary. The reference it holds may be a:


Field Summary
 DurableSubscriptionID (src) durableSubscriberID
           
 SpyMessage (src) hardReference
           
 int jmsDeliveryMode
           
 byte jmsPriority
           
 MessageCache (src) messageCache
           
 long messageExpiration
           
 long messageId
           
 long messageScheduledDelivery
           
static int NOT_STORED
          The message is not persisted
 java.lang.Object persistData
           
 BasicQueue (src) queue
           
 boolean redelivered
           
 int redeliveryCount
           
 long redeliveryDelay
           
 long referenceId
           
static int REMOVED
          It was a persistent message for a joint cache store/persistent manager.
 java.lang.ref.SoftReference softReference
           
 int stored
           
static int STORED
          The message is persisted
 
Method Summary
 int compareTo(java.lang.Object o)
          This method allows message to be order on the server queues by priority and the order that they came in on.
 boolean equals(java.lang.Object o)
           
 SpyMessage.Header (src) getHeaders()
          We could optimize caching by keeping the headers but not the body.
 SpyMessage (src) getMessage()
           
 SpyMessage (src) getMessageForDelivery()
           
 java.lang.String getPersistentKey()
          Determines the persistent for storing the message
 boolean inMemory()
          Are we entirely in memory?
 void invalidate()
           
 boolean isExpired()
          Returns true if this message reference has expired.
 boolean isLateClone()
          Are we late cloning messages?
 boolean isPersistent()
          Determines whether the message is persistent in the sense that it survives a crash
 void redelivered()
          The message is being redelivered
 void removeDelayed()
           
 void setStored(int stored)
          Called from A PeristenceManager/CacheStore, to let us know that this message is already stored on disk.
 java.lang.String toString()
          For debugging
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_STORED

public static final int NOT_STORED
The message is not persisted

See Also:
Constant Field Values (src)

STORED

public static final int STORED
The message is persisted

See Also:
Constant Field Values (src)

REMOVED

public static final int REMOVED
It was a persistent message for a joint cache store/persistent manager. This states guards against double removal from the cache while keeping error checking for incorrect double removal No message should be at this state for very long

See Also:
Constant Field Values (src)

referenceId

public long referenceId

hardReference

public SpyMessage (src)  hardReference

jmsPriority

public byte jmsPriority

messageId

public long messageId

jmsDeliveryMode

public int jmsDeliveryMode

messageScheduledDelivery

public long messageScheduledDelivery

messageExpiration

public long messageExpiration

redelivered

public boolean redelivered

redeliveryDelay

public long redeliveryDelay

redeliveryCount

public int redeliveryCount

queue

public BasicQueue (src)  queue

messageCache

public MessageCache (src)  messageCache

softReference

public java.lang.ref.SoftReference softReference

durableSubscriberID

public DurableSubscriptionID (src)  durableSubscriberID

stored

public int stored

persistData

public transient java.lang.Object persistData
Method Detail

getMessageForDelivery

public SpyMessage (src)  getMessageForDelivery()
                                 throws JMSException (src) 
Throws:
JMSException (src)

getMessage

public SpyMessage (src)  getMessage()
                      throws JMSException (src) 
Throws:
JMSException (src)

redelivered

public void redelivered()
                 throws JMSException (src) 
The message is being redelivered

Throws:
JMSException (src)

isExpired

public boolean isExpired()
Returns true if this message reference has expired.


isPersistent

public boolean isPersistent()
Determines whether the message is persistent in the sense that it survives a crash


inMemory

public boolean inMemory()
Are we entirely in memory?

Returns:
true when in memory, false otherwise

getPersistentKey

public java.lang.String getPersistentKey()
Determines the persistent for storing the message


isLateClone

public boolean isLateClone()
Are we late cloning messages?


getHeaders

public SpyMessage.Header (src)  getHeaders()
                             throws JMSException (src) 
We could optimize caching by keeping the headers but not the body. The server will uses the headers more often than the body and the headers take up much message memory than the body For now just return the message.

Throws:
JMSException (src)

invalidate

public void invalidate()
                throws JMSException (src) 
Throws:
JMSException (src)

removeDelayed

public void removeDelayed()
                   throws JMSException (src) 
Throws:
JMSException (src)

setStored

public void setStored(int stored)
Called from A PeristenceManager/CacheStore, to let us know that this message is already stored on disk.


equals

public boolean equals(java.lang.Object o)

compareTo

public int compareTo(java.lang.Object o)
This method allows message to be order on the server queues by priority and the order that they came in on.

Specified by:
compareTo in interface java.lang.Comparable
See Also:
Comparable.compareTo(Object)

toString

public java.lang.String toString()
For debugging