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:
MessageReceiver, Node
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,v 1.22 2005/03/15 19:40:44 jeffh Exp $
Author:
Alan Mislove

Nested Class Summary
static class DistPastryNode.ProcessingQueue
          DESCRIBE THE CLASS
static class DistPastryNode.ProcessingQueueOverflowException
          DESCRIBE THE CLASS
 
Field Summary
protected  int leafSetMaintFreq
          DESCRIBE THE FIELD
protected  ScheduledMessage leafSetRoutineMaintenance
          DESCRIBE THE FIELD
static DistPastryNode.ProcessingQueue QUEUE
          DESCRIBE THE FIELD
protected  int routeSetMaintFreq
          DESCRIBE THE FIELD
protected  ScheduledMessage routeSetRoutineMaintenance
          DESCRIBE THE FIELD
static rice.pastry.dist.DistPastryNode.ProcessingThread THREAD
          DESCRIBE THE FIELD
protected static Timer timer
          DESCRIBE THE FIELD
static boolean verbose
          DESCRIBE THE FIELD
 
Fields inherited from class rice.pastry.PastryNode
apps, EC_NO_CODE_AVAILABLE, localhandle, myNodeId, nodeHandleSet
 
Constructor Summary
protected DistPastryNode(NodeId id)
          Constructor, with NodeId.
 
Method Summary
static void addError(java.lang.String error)
          Adds a feature to the Error attribute of the DistPastryNode class
 void addNetworkListener(NetworkListener listener)
          Adds a feature to the NetworkListener attribute of the DistPastryNode object
 void broadcastReceivedListeners(java.lang.Object message, java.net.InetSocketAddress[] path, int size)
          DESCRIBE THE METHOD
 void broadcastSentListeners(java.lang.Object message, java.net.InetSocketAddress[] path, int size)
          DESCRIBE THE METHOD
 void doneNode(NodeHandle bootstrap)
          Called after the node is initialized.
static java.lang.String[] getErrors()
          Gets the Errors attribute of the DistPastryNode class
protected  NetworkListener[] getNetworkListeners()
          Gets the NetworkListeners attribute of the DistPastryNode object
abstract  DistNodeHandlePool getNodeHandlePool()
          Method which returns the Dist for this Pastry node.
 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.
 void resign()
          Method which kills a PastryNode (used only for testing).
 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
addLeafSetObserver, addRouteSetObserver, deleteLeafSetObserver, deleteRouteSetObserver, getErrorString, getId, getIdFactory, getLeafSet, getLocalHandle, getLocalNodeHandle, getLocalNodeI, getMessageDispatch, getNodeId, getRoutingTable, isClosest, isReady, messageNotSent, nodeIsReady, receiveMessage, registerApp, registerApplication, registerApplication, registerReceiver, 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

leafSetMaintFreq

protected int leafSetMaintFreq
DESCRIBE THE FIELD


routeSetMaintFreq

protected int routeSetMaintFreq
DESCRIBE THE FIELD


leafSetRoutineMaintenance

protected ScheduledMessage leafSetRoutineMaintenance
DESCRIBE THE FIELD


routeSetRoutineMaintenance

protected ScheduledMessage routeSetRoutineMaintenance
DESCRIBE THE FIELD


verbose

public static final boolean verbose
DESCRIBE THE FIELD

See Also:
Constant Field Values

QUEUE

public static DistPastryNode.ProcessingQueue QUEUE
DESCRIBE THE FIELD


THREAD

public static rice.pastry.dist.DistPastryNode.ProcessingThread THREAD
DESCRIBE THE FIELD


timer

protected static final Timer timer
DESCRIBE THE FIELD

Constructor Detail

DistPastryNode

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

Parameters:
id - 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

getNodeHandlePool

public abstract DistNodeHandlePool getNodeHandlePool()
Method which returns the Dist for this Pastry node.

Returns:
The node handle pool for this pastry node.

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

broadcastSentListeners

public void broadcastSentListeners(java.lang.Object message,
                                   java.net.InetSocketAddress[] path,
                                   int size)
DESCRIBE THE METHOD

Parameters:
message - DESCRIBE THE PARAMETER
path - DESCRIBE THE PARAMETER
size - DESCRIBE THE PARAMETER

broadcastReceivedListeners

public void broadcastReceivedListeners(java.lang.Object message,
                                       java.net.InetSocketAddress[] path,
                                       int size)
DESCRIBE THE METHOD

Parameters:
message - DESCRIBE THE PARAMETER
path - DESCRIBE THE PARAMETER
size - 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

resign

public void resign()
Method which kills a PastryNode (used only for testing).

Overrides:
resign 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

getErrors

public static java.lang.String[] getErrors()
Gets the Errors attribute of the DistPastryNode class

Returns:
The Errors value

addError

public static void addError(java.lang.String error)
Adds a feature to the Error attribute of the DistPastryNode class

Parameters:
error - The feature to be added to the Error attribute

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection