jrun.jms.core.messagemgr
Class AbstractMessageHandle

java.lang.Object
  |
  +--jrun.jms.core.messagemgr.AbstractMessageHandle
All Implemented Interfaces:
java.io.Externalizable, MessageHandle, java.io.Serializable
Direct Known Subclasses:
PersistentMessageHandle, TransientMessageHandle

public class AbstractMessageHandle
extends java.lang.Object
implements MessageHandle

A message handle is used to indirectly reference a message in the message manager. It can be resolved through the MessageManager

Version:
$Revision: 1.6 $ $Date: 2001/09/18 10:50:34 $
Author:
Jim Alateras
See Also:
Serialized Form

Constructor Summary
AbstractMessageHandle()
          Default constructor required to support Serialization
 
Method Summary
 void clear()
          Clear the message handle
 void destroy()
          Destroy this handle
 boolean equals(java.lang.Object object)
           
 long getAcceptedTime()
          Return time that the corresponding message was accepted.
 long getClientId()
          Retrieve the client identity associated with this handle
 boolean getDelivered()
          Check whether an attempt has already been made to deliver the message before.
 JmsDestination getDestination()
          Return the destination for this handle
 long getExpiryTime()
          Return the message expiry time
 MessageImpl getMessage()
          Return the associated message or null if it is invalid
 MessageId getMessageId()
          Return the message id
 int getPriority()
          Return the priority of the underlying message
 long getSequenceNumber()
          Return message's sequence number
 int hashCode()
           
 void readExternal(java.io.ObjectInput stream)
           
 void setAcceptedTime(long time)
          Set the time that the message was accepted by the server
 void setClientId(long clientId)
          Set the client id, that owns this handle
 void setDelivered()
          Set the message, corresponding to this handle, has already been delivered once before
 void setDelivered(boolean value)
          Set the delivered flag for the underlying message.
 void setDestination(JmsDestination destination)
          Set the destination that owns this handle
 void setExpiryTime(long time)
          Set the message expiry time
 void setMessageId(MessageId id)
          Set the message identity
 void setPriority(int priority)
          Set the message priority
 void setSequenceNumber(long seq)
          Set the message's sequence number
 java.lang.String toString()
          Return a stringified version of the handle
 void writeExternal(java.io.ObjectOutput stream)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractMessageHandle

public AbstractMessageHandle()
Default constructor required to support Serialization
Method Detail

getMessageId

public MessageId getMessageId()
Return the message id
Specified by:
getMessageId in interface MessageHandle
Returns:
MessgeId

setMessageId

public void setMessageId(MessageId id)
Set the message identity
Parameters:
id - - the message identity

setDelivered

public void setDelivered()
Set the message, corresponding to this handle, has already been delivered once before
Specified by:
setDelivered in interface MessageHandle

setDelivered

public void setDelivered(boolean value)
Set the delivered flag for the underlying message. True if an attempt has been made to deliver the message
Parameters:
value - - true if delivered

getDelivered

public boolean getDelivered()
Check whether an attempt has already been made to deliver the message before.
Specified by:
getDelivered in interface MessageHandle
Returns:
boolean - true implies redelivery attempted

setPriority

public void setPriority(int priority)
Set the message priority
Specified by:
setPriority in interface MessageHandle
Parameters:
int - - the message priority

getPriority

public int getPriority()
Return the priority of the underlying message
Specified by:
getPriority in interface MessageHandle
Returns:
int - message priority

setAcceptedTime

public void setAcceptedTime(long time)
Set the time that the message was accepted by the server
Specified by:
setAcceptedTime in interface MessageHandle
Parameters:
time - - accepted time

getAcceptedTime

public long getAcceptedTime()
Return time that the corresponding message was accepted.
Specified by:
getAcceptedTime in interface MessageHandle
Returns:
long - the accepted time.

setExpiryTime

public void setExpiryTime(long time)
Set the message expiry time
Specified by:
setExpiryTime in interface MessageHandle
Following copied from interface: jrun.jms.core.message.MessageHandle
Parameters:
time - - time that it was set in ms

getExpiryTime

public long getExpiryTime()
Return the message expiry time
Specified by:
getExpiryTime in interface MessageHandle
Returns:
long - time in ms since epoch

setSequenceNumber

public void setSequenceNumber(long seq)
Set the message's sequence number
Specified by:
setSequenceNumber in interface MessageHandle
Parameters:
seq - - sequence time

getSequenceNumber

public long getSequenceNumber()
Return message's sequence number
Specified by:
getSequenceNumber in interface MessageHandle
Returns:
long - the sequence number

setDestination

public void setDestination(JmsDestination destination)
Set the destination that owns this handle
Specified by:
setDestination in interface MessageHandle
Parameters:
destination - - the destination

getDestination

public JmsDestination getDestination()
Return the destination for this handle
Specified by:
getDestination in interface MessageHandle
Returns:
JmsDestination

setClientId

public void setClientId(long clientId)
Set the client id, that owns this handle
Specified by:
setClientId in interface MessageHandle
Parameters:
clientId - - client identity

getClientId

public long getClientId()
Retrieve the client identity associated with this handle
Specified by:
getClientId in interface MessageHandle
Returns:
long

getMessage

public MessageImpl getMessage()
Return the associated message or null if it is invalid
Specified by:
getMessage in interface MessageHandle
Returns:
MessageImpl

toString

public java.lang.String toString()
Return a stringified version of the handle
Overrides:
toString in class java.lang.Object
Returns:
String

clear

public void clear()
Clear the message handle
Specified by:
clear in interface MessageHandle

destroy

public void destroy()
Destroy this handle
Specified by:
destroy in interface MessageHandle

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

writeExternal

public void writeExternal(java.io.ObjectOutput stream)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable

readExternal

public void readExternal(java.io.ObjectInput stream)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable


Copyright � 2002 Macromedia Corporation. All Rights Reserved.