Rice Pastry API

rice.pastry.direct
Class DirectPastryNode

java.lang.Object
  extended by java.util.Observable
      extended by rice.pastry.PastryNode
          extended by rice.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 3613 2007-02-15 14:45:14Z jstewart $
Author:
Sitaram Iyer

Field Summary
protected  Timer timer
           
 
Fields inherited from class rice.pastry.PastryNode
apps, joinFailed, joinFailedReason, leafSet, localhandle, logger, myNodeId, routeSet
 
Constructor Summary
DirectPastryNode(Id id, NetworkSimulator sim, Environment e, NodeRecord nr)
           
 
Method Summary
 NodeHandle coalesce(NodeHandle newHandle)
           
 void connect(NodeHandle remoteNode, AppSocketReceiver receiver, PastryAppl appl, int timeout)
          Called by PastryAppl to ask the transport layer to open a Socket to its counterpart on another node.
 void destroy()
          Method which kills a PastryNode.
 void doneNode(NodeHandle[] bootstrap)
           
static DirectPastryNode getCurrentNode()
           
 Logger getLogger()
           
 void initiateJoin(NodeHandle[] bootstrap)
          Overridden by derived classes to initiate the join process
 boolean isAlive()
           
 void nodeIsReady()
          Called from PastryNode after the join succeeds.
 int proximity(NodeHandle that)
          The proximity of the node handle.
 NodeHandle readNodeHandle(InputBuffer buf)
           
 void receiveMessage(Message msg)
          message receiver interface.
 void route(RouteMessage rm)
           
 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 nh, Message m)
          Deliver message to the NodeHandle.
static DirectPastryNode setCurrentNode(DirectPastryNode dpn)
          Returns the previous one.
 
Methods inherited from class rice.pastry.PastryNode
addDestructable, addLeafSetListener, addLeafSetObserver, addRouteSetListener, addRouteSetObserver, buildEndpoint, deleteLeafSetListener, deleteLeafSetObserver, deleteRouteSetObserver, getDefaultReadyStrategy, getEnvironment, getId, getIdFactory, getLeafSet, getLocalHandle, getLocalNodeHandle, getMessageDispatch, getNodeId, getRoutingTable, isClosest, isReady, joinFailed, joinFailed, joinFailedReason, nodeIsReady, notifyReadyObservers, process, receiveMessage, registerApp, registerApplication, registerReceiver, removeDestructable, removeRouteSetListener, setElements, setMessageDispatch, setReady, setReady, setReadyStrategy, 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

timer

protected Timer timer
Constructor Detail

DirectPastryNode

public DirectPastryNode(Id id,
                        NetworkSimulator sim,
                        Environment e,
                        NodeRecord nr)
Method Detail

setCurrentNode

public static DirectPastryNode setCurrentNode(DirectPastryNode dpn)
Returns the previous one.

Parameters:
dnh -
Returns:

getCurrentNode

public static DirectPastryNode getCurrentNode()

doneNode

public void doneNode(NodeHandle[] bootstrap)

isAlive

public boolean isAlive()

destroy

public void destroy()
Description copied from class: PastryNode
Method which kills a PastryNode. Note, this doesn't implicitly kill the environment. Make sure to call super.destroy() !!!

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

initiateJoin

public final void initiateJoin(NodeHandle[] bootstrap)
Description copied from class: PastryNode
Overridden by derived classes to initiate the join process

Specified by:
initiateJoin in class PastryNode
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)
Specified by:
coalesce in class PastryNode

receiveMessage

public void receiveMessage(Message msg)
Description copied from class: PastryNode
message receiver interface. synchronized so that the external message processing thread and the leafset/route maintenance thread won't interfere with application messages.

Overrides:
receiveMessage in class PastryNode

route

public void route(RouteMessage rm)

getLogger

public Logger getLogger()

proximity

public int proximity(NodeHandle that)
Description copied from class: PastryNode
The proximity of the node handle.

Specified by:
proximity in class PastryNode
Returns:

send

public void send(NodeHandle nh,
                 Message m)
Description copied from class: PastryNode
Deliver message to the NodeHandle.

Specified by:
send in class PastryNode

connect

public void connect(NodeHandle remoteNode,
                    AppSocketReceiver receiver,
                    PastryAppl appl,
                    int timeout)
Description copied from class: PastryNode
Called by PastryAppl to ask the transport layer to open a Socket to its counterpart on another node.

Specified by:
connect in class PastryNode

readNodeHandle

public NodeHandle readNodeHandle(InputBuffer buf)

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection