Rice Pastry API

rice.rm.messaging
Class RMResponseKeysMsg

java.lang.Object
  |
  +--rice.pastry.messaging.Message
        |
        +--rice.rm.messaging.RMMessage
              |
              +--rice.rm.messaging.RMResponseKeysMsg
All Implemented Interfaces:
java.io.Serializable

public class RMResponseKeysMsg
extends RMMessage
implements java.io.Serializable

Version:
$Id: RMResponseKeysMsg.java,v 1.13 2003/07/23 23:52:50 animesh Exp $
Author:
Animesh Nandi
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class rice.rm.messaging.RMMessage
RMMessage.KEEntry
 
Field Summary
 
Fields inherited from class rice.rm.messaging.RMMessage
_seqno, _source
 
Constructor Summary
RMResponseKeysMsg(rice.pastry.NodeHandle source, rice.pastry.messaging.Address address, rice.pastry.security.Credentials authorCred, int seqno, java.util.Vector _rangeSet, int _eventId)
          Constructor : Builds a new RM Message
 
Method Summary
 int getEventId()
           
 void handleDeliverMessage(rice.rm.RMImpl rm)
          The handling of the message does the following - 1.
 
Methods inherited from class rice.rm.messaging.RMMessage
getCredentials, getSeqno, getSource
 
Methods inherited from class rice.pastry.messaging.Message
getDate, getDestination, getSenderId, getStream, hasPriority, setPriority, setSenderId, stamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RMResponseKeysMsg

public RMResponseKeysMsg(rice.pastry.NodeHandle source,
                         rice.pastry.messaging.Address address,
                         rice.pastry.security.Credentials authorCred,
                         int seqno,
                         java.util.Vector _rangeSet,
                         int _eventId)
Constructor : Builds a new RM Message

Parameters:
source - the source of the message
address - the RM application address
authorCred - the credentials of the source
seqno - for debugging purposes only
_rangeSet - the rangeSet of this message
_eventId - the eventId of this message
Method Detail

handleDeliverMessage

public void handleDeliverMessage(rice.rm.RMImpl rm)
The handling of the message does the following - 1. Removes the event characterized by 'eventId' from the m_PendingEvents hashtable signifying that a response to the message was received to ensure that on the occurrence of the timeout, the message is NOT resent. 2. We then iterate over the 'rangeSet' for each entry of type RMMessage.KEEntry we do the following: a) If the entire key set for the rangge was requested, it notifies the RMClient to fetch() the keys in that set. Additionally, it removes this range from the list of pending ranges in the m_pendingRanges hashtable. b) If only the hash of the keys in the range was requested and the hash matched then we remove this range from the list of pending ranges in the m_pendingRanges hashtable. c) If only the hash of the keys in the range was requested and the hash did not match, then we update the entry corresponding to this range in the pending ranges list with the number of keys in this range as notified by the source of the message. 3. We now iterate over the pending Ranges list and split the ranges whose expected number of keys('numKeys') is greater than MAXKEYSINRANGE. The splitting method is recursive binary spliting until we get a total SPLITFACTOR number of subranges from the intitial range. 4. At this point all ranges in the pendingRanges list have either a value of 'numKeys' less than MAXKEYSINRANGE or a value or '-1' denoting uninitialized. 5. Now we iterate over this list of pending ranges and build a new RMRequestKeysMsg with a new rangeSet called 'toAskFor' in the code below. All add all ranges with uninitialized value of 'numKeys' to the new list 'toAskFor' setting their 'hashEnabled' field in their corresponding RMMessage.KEEntry to 'true', signifying that it is interested only in the hash value of the keys in this range. Additonally, it also adds ranges with already initialized 'numKeys' values to this 'toAskFor' list with the 'hashEnabled' field set to 'false' as long as the total size of the key sets corresponding to the entries in 'toAskFor' is less than MAXKEYSINRANGE. 6. Sends the new RMRequestKeysMsg with this 'toAskFor' list. Additionally, in order to implement the TIMEOUT mechanism to handle loss of RMRequestKeysMsg, we wrap the RMRequestKeysMsg in a RMTimeoutMsg which we schedule on the local node after a TIMEOUT period.

Specified by:
handleDeliverMessage in class RMMessage

getEventId

public int getEventId()

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection