Rice Pastry API

rice.pastry.dist
Class DistPastryNode

java.lang.Object
  extended byjava.util.Observable
      extended byrice.pastry.PastryNode
          extended byrice.pastry.dist.DistPastryNode
All Implemented Interfaces:
Destructable, Node, NodeHandleFactory
Direct Known Subclasses:
SocketPastryNode

public abstract class DistPastryNode
extends PastryNode

Class which represents the abstraction of a "real" pastry node. Designed to be extended by the protocol implementation (i.e. RMI or Socket) desired.

Version:
$Id: DistPastryNode.java 3274 2006-05-15 16:17:47Z jeffh $
Author:
Alan Mislove

Field Summary
protected  int leafSetMaintFreq
          DESCRIBE THE FIELD
protected  ScheduledMessage leafSetRoutineMaintenance
          DESCRIBE THE FIELD
protected  int routeSetMaintFreq
          DESCRIBE THE FIELD
protected  ScheduledMessage routeSetRoutineMaintenance
          DESCRIBE THE FIELD
protected  Timer timer
          DESCRIBE THE FIELD
 
Fields inherited from class rice.pastry.PastryNode
apps, localhandle, logger, myNodeId
 
Constructor Summary
protected DistPastryNode(Id id, Environment e)
          Constructor, with NodeId.
 
Method Summary
 void addNetworkListener(NetworkListener listener)
          Adds a feature to the NetworkListener attribute of the DistPastryNode object
 void broadcastChannelClosed(java.net.InetSocketAddress addr)
          DESCRIBE THE METHOD
 void broadcastChannelOpened(java.net.InetSocketAddress addr, int reason)
          DESCRIBE THE METHOD
 void broadcastReceivedListeners(java.lang.Object message, java.net.InetSocketAddress from, int size, int type)
          DESCRIBE THE METHOD
 void broadcastSentListeners(java.lang.Object message, java.net.InetSocketAddress dest, int size, int type)
          DESCRIBE THE METHOD
 void destroy()
          Method which kills a PastryNode (used only for testing).
 void doneNode(NodeHandle bootstrap)
          Called after the node is initialized.
protected  NetworkListener[] getNetworkListeners()
          Gets the NetworkListeners attribute of the DistPastryNode object
 Timer getTimer()
          Gets the Timer attribute of the DistPastryNode object
 void initiateJoin(NodeHandle bootstrap)
          Sends an InitiateJoin message to itself.
 void nodeIsReady()
          Called from PastryNode when the join succeeds.
 void process(Executable task, Continuation command)
          Schedules a job for processing on the dedicated processing thread.
 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.
 ExponentialBackoffScheduledMessage scheduleMsgExpBackoff(Message msg, long delay, long initialPeriod, double expBase)
          DESCRIBE THE METHOD
 
Methods inherited from class rice.pastry.PastryNode
addLeafSetListener, addLeafSetObserver, addRouteSetListener, addRouteSetObserver, buildEndpoint, coalesce, connect, deleteLeafSetListener, deleteLeafSetObserver, deleteRouteSetObserver, getEnvironment, getId, getIdFactory, getLeafSet, getLocalHandle, getLocalNodeHandle, getMessageDispatch, getNodeId, getRoutingTable, isClosest, isReady, nodeIsReady, receiveMessage, receiveMessage, registerApp, registerApplication, registerReceiver, removeRouteSetListener, send, 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
 
Methods inherited from interface rice.pastry.NodeHandleFactory
readNodeHandle
 

Field Detail

leafSetMaintFreq

protected int leafSetMaintFreq
DESCRIBE THE FIELD


routeSetMaintFreq

protected int routeSetMaintFreq
DESCRIBE THE FIELD


timer

protected Timer timer
DESCRIBE THE FIELD


leafSetRoutineMaintenance

protected ScheduledMessage leafSetRoutineMaintenance
DESCRIBE THE FIELD


routeSetRoutineMaintenance

protected ScheduledMessage routeSetRoutineMaintenance
DESCRIBE THE FIELD

Constructor Detail

DistPastryNode

protected DistPastryNode(Id id,
                         Environment e)
Constructor, with NodeId. Need to set the node's ID before this node is inserted as localHandle.localNode.

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

getTimer

public Timer getTimer()
Gets the Timer attribute of the DistPastryNode object

Returns:
The Timer value

getNetworkListeners

protected NetworkListener[] getNetworkListeners()
Gets the NetworkListeners attribute of the DistPastryNode object

Returns:
The NetworkListeners value

addNetworkListener

public void addNetworkListener(NetworkListener listener)
Adds a feature to the NetworkListener attribute of the DistPastryNode object

Parameters:
listener - The feature to be added to the NetworkListener attribute

broadcastChannelClosed

public void broadcastChannelClosed(java.net.InetSocketAddress addr)
DESCRIBE THE METHOD

Parameters:
addr - DESCRIBE THE PARAMETER

broadcastChannelOpened

public void broadcastChannelOpened(java.net.InetSocketAddress addr,
                                   int reason)
DESCRIBE THE METHOD

Parameters:
addr - DESCRIBE THE PARAMETER
reason - DESCRIBE THE PARAMETER

broadcastSentListeners

public void broadcastSentListeners(java.lang.Object message,
                                   java.net.InetSocketAddress dest,
                                   int size,
                                   int type)
DESCRIBE THE METHOD

Parameters:
message - DESCRIBE THE PARAMETER
dest - DESCRIBE THE PARAMETER
size - DESCRIBE THE PARAMETER
type - DESCRIBE THE PARAMETER

broadcastReceivedListeners

public void broadcastReceivedListeners(java.lang.Object message,
                                       java.net.InetSocketAddress from,
                                       int size,
                                       int type)
DESCRIBE THE METHOD

Parameters:
message - DESCRIBE THE PARAMETER
from - DESCRIBE THE PARAMETER
size - DESCRIBE THE PARAMETER
type - DESCRIBE THE PARAMETER

initiateJoin

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

Specified by:
initiateJoin in class PastryNode
Parameters:
bootstrap - Node handle to bootstrap with.

nodeIsReady

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

Specified by:
nodeIsReady in class PastryNode

doneNode

public void doneNode(NodeHandle bootstrap)
Called after the node is initialized.

Parameters:
bootstrap - DESCRIBE THE PARAMETER

destroy

public void destroy()
Method which kills a PastryNode (used only for testing). Make sure to call super.destroy() !!!

Specified by:
destroy in interface Destructable
Overrides:
destroy 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

scheduleMsgExpBackoff

public ExponentialBackoffScheduledMessage scheduleMsgExpBackoff(Message msg,
                                                                long delay,
                                                                long initialPeriod,
                                                                double expBase)
DESCRIBE THE METHOD

Parameters:
msg - DESCRIBE THE PARAMETER
delay - DESCRIBE THE PARAMETER
initialPeriod - DESCRIBE THE PARAMETER
expBase - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

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

process

public void process(Executable task,
                    Continuation command)
Schedules a job for processing on the dedicated processing thread. CPU intensive jobs, such as encryption, erasure encoding, or bloom filter creation should never be done in the context of the underlying node's thread, and should only be done via this method.

Overrides:
process in class PastryNode
Parameters:
task - The task to run on the processing thread
command - The command to return the result to once it's done

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection