org.jboss.messaging.core.plugin
Class SimpleMessageReference

java.lang.Object
  extended byorg.jboss.messaging.core.message.RoutableSupport
      extended byorg.jboss.messaging.core.plugin.SimpleMessageReference
All Implemented Interfaces:
java.io.Externalizable, MessageReference, Routable, java.io.Serializable

public class SimpleMessageReference
extends RoutableSupport
implements MessageReference

A Simple MessageReference implementation. Note that we do not need WeakReferences to message/holder objects since with the new lazy loading schema we guarantee that if a message ref is in memory - it's corresponding message is in memory too

Version:
1.3 SimpleMessageReference.java,v 1.3 2006/02/23 17:45:57 timfox Exp
Author:
Serialized Form

Field Summary
protected  MessageStore ms
           
 
Fields inherited from class org.jboss.messaging.core.message.RoutableSupport
BOOLEAN, BYTE, BYTES, deliveryCount, DOUBLE, expiration, FLOAT, headers, INT, LIST, LONG, MAP, messageID, NULL, OBJECT, priority, reliable, SHORT, STRING, timestamp
 
Fields inherited from interface org.jboss.messaging.core.Routable
COLLECTOR_ID, REMOTE_ROUTABLE, REPLICATOR_ID
 
Constructor Summary
  SimpleMessageReference()
          Required by externalization.
protected SimpleMessageReference(long messageID, boolean reliable, long expiration, long timestamp, java.util.Map headers, int deliveryCount, byte priority, MessageStore ms)
           
  SimpleMessageReference(org.jboss.messaging.core.plugin.MessageHolder holder, MessageStore ms)
          Creates a reference based on a given message.
  SimpleMessageReference(SimpleMessageReference other)
           
 
Method Summary
 MessageReference copy()
           
 boolean equals(java.lang.Object o)
           
 int getInMemoryChannelCount()
           
 Message getMessage()
          If it is a Message instance, then it returns itself, otherwise it will return the Message corresponding to this MessageReference.
 long getOrdering()
           
 java.io.Serializable getStoreID()
           
 int hashCode()
           
 boolean isReference()
           
 void releaseMemoryReference()
           
 void setOrdering(long ordering)
           
 java.lang.String toString()
           
 
Methods inherited from class org.jboss.messaging.core.message.RoutableSupport
containsHeader, decrementDeliveryCount, getDeliveryCount, getExpiration, getHeader, getHeaderNames, getHeaders, getMessageID, getPriority, getTimestamp, incrementDeliveryCount, internalReadObject, internalWriteObject, isExpired, isReliable, putHeader, readExternal, readList, readMap, removeHeader, setDeliveryCount, setPriority, setReliable, writeExternal, writeList, writeMap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.messaging.core.Routable
containsHeader, decrementDeliveryCount, getDeliveryCount, getExpiration, getHeader, getHeaderNames, getHeaders, getMessageID, getPriority, getTimestamp, incrementDeliveryCount, isExpired, isReliable, putHeader, removeHeader, setDeliveryCount, setPriority, setReliable
 

Field Detail

ms

protected transient MessageStore ms
Constructor Detail

SimpleMessageReference

public SimpleMessageReference()
Required by externalization.


SimpleMessageReference

public SimpleMessageReference(org.jboss.messaging.core.plugin.MessageHolder holder,
                              MessageStore ms)
Creates a reference based on a given message.


SimpleMessageReference

public SimpleMessageReference(SimpleMessageReference other)

SimpleMessageReference

protected SimpleMessageReference(long messageID,
                                 boolean reliable,
                                 long expiration,
                                 long timestamp,
                                 java.util.Map headers,
                                 int deliveryCount,
                                 byte priority,
                                 MessageStore ms)
Method Detail

isReference

public boolean isReference()
Specified by:
isReference in interface Routable

getStoreID

public java.io.Serializable getStoreID()
Specified by:
getStoreID in interface MessageReference

getMessage

public Message getMessage()
Description copied from interface: Routable
If it is a Message instance, then it returns itself, otherwise it will return the Message corresponding to this MessageReference.

Specified by:
getMessage in interface Routable

releaseMemoryReference

public void releaseMemoryReference()
Specified by:
releaseMemoryReference in interface MessageReference

getInMemoryChannelCount

public int getInMemoryChannelCount()
Specified by:
getInMemoryChannelCount in interface MessageReference

getOrdering

public long getOrdering()
Specified by:
getOrdering in interface MessageReference

setOrdering

public void setOrdering(long ordering)
Specified by:
setOrdering in interface MessageReference

copy

public MessageReference copy()
Specified by:
copy in interface MessageReference

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

toString

public java.lang.String toString()
Overrides:
toString in class RoutableSupport


Copyright © 2006 JBoss Inc. All Rights Reserved.