Rice Pastry API

rice.pastry.direct
Class DirectPastryNode

java.lang.Object
  extended byjava.util.Observable
      extended byrice.pastry.PastryNode
          extended byrice.pastry.direct.DirectPastryNode
All Implemented Interfaces:
Destructable, Node, NodeHandleFactory

public class DirectPastryNode
extends PastryNode

Direct pastry node. Subclasses PastryNode, and does about nothing else.

Version:
$Id: DirectPastryNode.java 3274 2006-05-15 16:17:47Z jeffh $
Author:
Sitaram Iyer

Field Summary
protected  boolean alive
          DESCRIBE THE FIELD
static DirectPastryNode currentNode
          Used for proximity calculation of DirectNodeHandle.
protected  Timer timer
          DESCRIBE THE FIELD
 
Fields inherited from class rice.pastry.PastryNode
apps, localhandle, logger, myNodeId
 
Constructor Summary
DirectPastryNode(Id id, NetworkSimulator sim, Environment e, NodeRecord nr)
          Constructor for DirectPastryNode.
 
Method Summary
 NodeHandle coalesce(NodeHandle newHandle)
          DESCRIBE THE METHOD
 void connect(NodeHandle remoteNode, AppSocketReceiver receiver, PastryAppl appl, int timeout)
          DESCRIBE THE METHOD
 void destroy()
          DESCRIBE THE METHOD
 void doneNode(NodeHandle bootstrap)
          DESCRIBE THE METHOD
 Logger getLogger()
          Gets the Logger attribute of the DirectPastryNode object
 void initiateJoin(NodeHandle bootstrap)
          DESCRIBE THE METHOD
 void initiateJoin(NodeHandle[] bootstrap)
          Sends an InitiateJoin message to itself.
 boolean isAlive()
          Gets the Alive attribute of the DirectPastryNode object
 void nodeIsReady()
          Called from PastryNode after the join succeeds.
 NodeHandle readNodeHandle(InputBuffer buf)
          DESCRIBE THE METHOD
 void receiveMessage(Message msg)
          DESCRIBE THE METHOD
 void route(RouteMessage rm)
          DESCRIBE THE METHOD
 ScheduledMessage scheduleMsg(Message msg, long delay)
          Schedule the specified message to be sent to the local node after a specified delay.
 ScheduledMessage scheduleMsg(Message msg, long delay, long period)
          Schedule the specified message for repeated fixed-delay delivery to the local node, beginning after the specified delay.
 ScheduledMessage scheduleMsgAtFixedRate(Message msg, long delay, long period)
          Schedule the specified message for repeated fixed-rate delivery to the local node, beginning after the specified delay.
 void send(NodeHandle handle, Message message)
          DESCRIBE THE METHOD
 
Methods inherited from class rice.pastry.PastryNode
addLeafSetListener, addLeafSetObserver, addRouteSetListener, addRouteSetObserver, buildEndpoint, deleteLeafSetListener, deleteLeafSetObserver, deleteRouteSetObserver, getEnvironment, getId, getIdFactory, getLeafSet, getLocalHandle, getLocalNodeHandle, getMessageDispatch, getNodeId, getRoutingTable, isClosest, isReady, nodeIsReady, process, receiveMessage, registerApp, registerApplication, registerReceiver, removeRouteSetListener, setElements, setMessageDispatch, setReady, setReady, toString
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

alive

protected boolean alive
DESCRIBE THE FIELD


timer

protected Timer timer
DESCRIBE THE FIELD


currentNode

public static DirectPastryNode currentNode
Used for proximity calculation of DirectNodeHandle. This will probably go away when we switch to a byte-level protocol.

Constructor Detail

DirectPastryNode

public DirectPastryNode(Id id,
                        NetworkSimulator sim,
                        Environment e,
                        NodeRecord nr)
Constructor for DirectPastryNode.

Parameters:
id - DESCRIBE THE PARAMETER
sim - DESCRIBE THE PARAMETER
e - DESCRIBE THE PARAMETER
nr - DESCRIBE THE PARAMETER
Method Detail

isAlive

public boolean isAlive()
Gets the Alive attribute of the DirectPastryNode object

Returns:
The Alive value

getLogger

public Logger getLogger()
Gets the Logger attribute of the DirectPastryNode object

Returns:
The Logger value

doneNode

public void doneNode(NodeHandle bootstrap)
DESCRIBE THE METHOD

Parameters:
bootstrap - DESCRIBE THE PARAMETER

destroy

public void destroy()
DESCRIBE THE METHOD

Specified by:
destroy in interface Destructable
Overrides:
destroy in class PastryNode

initiateJoin

public final void initiateJoin(NodeHandle bootstrap)
DESCRIBE THE METHOD

Specified by:
initiateJoin in class PastryNode
Parameters:
bootstrap - DESCRIBE THE PARAMETER

initiateJoin

public final void initiateJoin(NodeHandle[] bootstrap)
Sends an InitiateJoin message to itself.

Parameters:
bootstrap - Node handle to bootstrap with.

nodeIsReady

public final void nodeIsReady()
Called from PastryNode after the join succeeds.

Specified by:
nodeIsReady in class PastryNode

scheduleMsg

public ScheduledMessage scheduleMsg(Message msg,
                                    long delay)
Schedule the specified message to be sent to the local node after a specified delay. Useful to provide timeouts.

Specified by:
scheduleMsg in class PastryNode
Parameters:
msg - a message that will be delivered to the local node after the specified delay
delay - time in milliseconds before message is to be delivered
Returns:
the scheduled event object; can be used to cancel the message

scheduleMsg

public ScheduledMessage scheduleMsg(Message msg,
                                    long delay,
                                    long period)
Schedule the specified message for repeated fixed-delay delivery to the local node, beginning after the specified delay. Subsequent executions take place at approximately regular intervals separated by the specified period. Useful to initiate periodic tasks.

Specified by:
scheduleMsg in class PastryNode
Parameters:
msg - a message that will be delivered to the local node after the specified delay
delay - time in milliseconds before message is to be delivered
period - time in milliseconds between successive message deliveries
Returns:
the scheduled event object; can be used to cancel the message

scheduleMsgAtFixedRate

public ScheduledMessage scheduleMsgAtFixedRate(Message msg,
                                               long delay,
                                               long period)
Schedule the specified message for repeated fixed-rate delivery to the local node, beginning after the specified delay. Subsequent executions take place at approximately regular intervals, separated by the specified period.

Specified by:
scheduleMsgAtFixedRate in class PastryNode
Parameters:
msg - a message that will be delivered to the local node after the specified delay
delay - time in milliseconds before message is to be delivered
period - time in milliseconds between successive message deliveries
Returns:
the scheduled event object; can be used to cancel the message

coalesce

public NodeHandle coalesce(NodeHandle newHandle)
DESCRIBE THE METHOD

Specified by:
coalesce in class PastryNode
Parameters:
newHandle - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

receiveMessage

public void receiveMessage(Message msg)
DESCRIBE THE METHOD

Overrides:
receiveMessage in class PastryNode
Parameters:
msg - DESCRIBE THE PARAMETER

route

public void route(RouteMessage rm)
DESCRIBE THE METHOD

Parameters:
rm - DESCRIBE THE PARAMETER

send

public void send(NodeHandle handle,
                 Message message)
DESCRIBE THE METHOD

Specified by:
send in class PastryNode
Parameters:
handle - DESCRIBE THE PARAMETER
message - DESCRIBE THE PARAMETER

connect

public void connect(NodeHandle remoteNode,
                    AppSocketReceiver receiver,
                    PastryAppl appl,
                    int timeout)
DESCRIBE THE METHOD

Specified by:
connect in class PastryNode
Parameters:
remoteNode - DESCRIBE THE PARAMETER
receiver - DESCRIBE THE PARAMETER
appl - DESCRIBE THE PARAMETER
timeout - DESCRIBE THE PARAMETER

readNodeHandle

public NodeHandle readNodeHandle(InputBuffer buf)
DESCRIBE THE METHOD

Parameters:
buf - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection