Rice Pastry API

rice.pastry.messaging
Class Message

java.lang.Object
  extended by rice.pastry.messaging.Message
All Implemented Interfaces:
java.io.Serializable, Message
Direct Known Subclasses:
HelloMsg, InitiateJoin, InitiateLeafSetMaintenance, InitiatePingNeighbor, InitiateRouteSetMaintenance, PingMessageNew, PRawMessage

public abstract class Message
extends java.lang.Object
implements java.io.Serializable, Message

This is an abstract implementation of a message object.

Version:
$Id: Message.java 3524 2007-01-09 14:09:27Z jeffh $
Author:
Andrew Ladd, Sitaram Iyer
See Also:
Serialized Form

Field Summary
static int DEFAULT_PRIORITY_LEVEL
           
 
Fields inherited from interface rice.p2p.commonapi.Message
HIGH_PRIORITY, LOW_PRIORITY, LOWEST_PRIORITY, MAX_PRIORITY, MEDIUM_HIGH_PRIORITY, MEDIUM_LOW_PRIORITY, MEDIUM_PRIORITY
 
Constructor Summary
Message(int dest)
          Constructor.
Message(int dest, java.util.Date timestamp)
          Constructor.
 
Method Summary
 java.util.Date getDate()
          Gets the timestamp of the message, if it exists.
 int getDestination()
          Gets the address of message receiver that the message is for.
 int getPriority()
          Get priority
 NodeHandle getSender()
          Get sender.
 Id getSenderId()
          Get sender Id.
protected  void setPriority(int prio)
          Set priority.
 void setSender(NodeHandle nh)
          Set sender Id.
 boolean stamp(java.util.Date time)
          If the message has no timestamp, this will stamp the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PRIORITY_LEVEL

public static final int DEFAULT_PRIORITY_LEVEL
See Also:
Constant Field Values
Constructor Detail

Message

public Message(int dest)
Constructor.

Parameters:
dest - the destination.

Message

public Message(int dest,
               java.util.Date timestamp)
Constructor.

Parameters:
dest - the destination.
timestamp - the timestamp
Method Detail

getDestination

public int getDestination()
Gets the address of message receiver that the message is for.

Returns:
the destination id.

getDate

public java.util.Date getDate()
Gets the timestamp of the message, if it exists.

Returns:
a timestamp or null if the sender did not specify one.

getSenderId

public Id getSenderId()
Get sender Id.

Returns:
the immediate sender's NodeId.

getSender

public NodeHandle getSender()
Get sender.

Returns:
the immediate sender's NodeId.

setSender

public void setSender(NodeHandle nh)
Set sender Id. Called by NodeHandle just before dispatch, so that this Id is guaranteed to belong to the immediate sender.

Parameters:
the - immediate sender's NodeId.

getPriority

public int getPriority()
Get priority

Specified by:
getPriority in interface Message
Returns:
the priority of this message.

setPriority

protected void setPriority(int prio)
Set priority.

Parameters:
the - new priority.

stamp

public boolean stamp(java.util.Date time)
If the message has no timestamp, this will stamp the message.

Parameters:
time - the timestamp.
Returns:
true if the message was stamped, false if the message already had a timestamp.

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection