Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.mq.server
Class MessageReference

    java.lang.Object
      org.jboss.mq.server.MessageReference

All Implemented Interfaces:
  Comparable

public class MessageReference
extends Object
implements Comparable

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

- Hard Reference - The message is consider recently used and should not be paged out
- Soft Reference - The message is consider old and CAN be removed from memory by the GC
- No Reference - The message was removed from memory by the GC, but we can load it from a file.

Version:
  $Revision: 1.20 $
Author:
  Hiram Chirino, Peter Antman

Field Summary
`DurableSubscriptionID` | `durableSubscriberID`
`SpyMessage` | `hardReference`
`int` | `jmsDeliveryMode`
`byte` | `jmsPriority`
`MessageCache` | `messageCache`
`long` | `messageExpiration`
`long` | `messageId`
`long` | `messageScheduledDelivery`
`static int` | `NOT_STORED` The message is not persisted
`Object` | `persistData`
`BasicQueue` | `queue`
`boolean` | `redelivered`
`int` | `redeliveryCount`
`long` | `redeliveryDelay`
`long` | `referenceId`
`static int` | `REMOVED` It was a persistent message for a joint cache store/persistent manager.
`SoftReference` | `softReference`
`int` | `stored`
`static int` | `STORED` The message is persisted

Method Summary
`int` | `compareTo(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(Object o)`
`SpyMessage.Header` | `getHeaders()` We could optimize caching by keeping the headers but not the body.
`SpyMessage` | `getMessage()`
`SpyMessage` | `getMessageForDelivery()`
`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.
`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

### STORED

    public static final int STORED

  The message is persisted

  See Also:
    Constant Field Values

### 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

### referenceId

    public long referenceId

### hardReference

    public SpyMessage 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 queue

### messageCache

    public MessageCache messageCache

### softReference

    public SoftReference softReference

### durableSubscriberID

    public DurableSubscriptionID durableSubscriberID

### stored

    public int stored

### persistData

    public transient Object persistData

Method Detail

### getMessageForDelivery

    public SpyMessage getMessageForDelivery()
                                     throws javax.jms.JMSException

  Throws:
    `javax.jms.JMSException`

### getMessage

    public SpyMessage getMessage()
                          throws javax.jms.JMSException

  Throws:
    `javax.jms.JMSException`

### redelivered

    public void redelivered()
                     throws javax.jms.JMSException

  The message is being redelivered

  Throws:
    `javax.jms.JMSException`

### 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 String getPersistentKey()

  Determines the persistent for storing the message

### isLateClone

    public boolean isLateClone()

  Are we late cloning messages?

### getHeaders

    public SpyMessage.Header getHeaders()
                                 throws javax.jms.JMSException

  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:
    `javax.jms.JMSException`

### invalidate

    public void invalidate()
                    throws javax.jms.JMSException

  Throws:
    `javax.jms.JMSException`

### removeDelayed

    public void removeDelayed()
                       throws javax.jms.JMSException

  Throws:
    `javax.jms.JMSException`

### 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(Object o)

### compareTo

    public int compareTo(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 `Comparable`
  See Also:
    `Comparable.compareTo(Object)`

### toString

    public String toString()

  For debugging

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.