ePOST API

rice.pastry.dist
Class DistPastryNode

java.lang.Object
  extended by java.util.Observable
      extended by rice.pastry.PastryNode
          extended by rice.pastry.dist.DistPastryNode
All Implemented Interfaces:
Destructable, Node, MessageReceiver
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 2903 2006-01-10 19:49:02Z jeffh $
Author:
Alan Mislove

Field Summary
protected  int leafSetMaintFreq
           
protected  ScheduledMessage leafSetRoutineMaintenance
           
protected  int routeSetMaintFreq
           
protected  ScheduledMessage routeSetRoutineMaintenance
           
protected  Timer timer
           
 
Fields inherited from class rice.pastry.PastryNode
apps, localhandle, logger, myNodeId
 
Constructor Summary
protected DistPastryNode(NodeId id, Environment e)
          Constructor, with NodeId.
 
Method Summary
 void addNetworkListener(NetworkListener listener)
           
 void broadcastChannelClosed(java.net.InetSocketAddress addr)
           
 void broadcastChannelOpened(java.net.InetSocketAddress addr, int reason)
           
 void broadcastReceivedListeners(java.lang.Object message, java.net.InetSocketAddress from, int size, int type)
           
 void broadcastSentListeners(java.lang.Object message, java.net.InetSocketAddress dest, int size, int type)
           
 void destroy()
          Method which kills a PastryNode (used only for testing).
 void doneNode(NodeHandle bootstrap)
          Called after the node is initialized.
protected  NetworkListener[] getNetworkListeners()
           
 Timer getTimer()
           
 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)
           
 
Methods inherited from class rice.pastry.PastryNode
addLeafSetListener, addLeafSetObserver, addRouteSetListener, addRouteSetObserver, coalesce, deleteLeafSetListener, deleteLeafSetObserver, deleteRouteSetObserver, getEnvironment, getId, getIdFactory, getLeafSet, getLocalHandle, getLocalNodeHandle, getMessageDispatch, getNodeId, getRoutingTable, isClosest, isReady, nodeIsReady, receiveMessage, registerApp, registerApplication, 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
 

Field Detail

leafSetMaintFreq

protected int leafSetMaintFreq

routeSetMaintFreq

protected int routeSetMaintFreq

timer

protected Timer timer

leafSetRoutineMaintenance

protected ScheduledMessage leafSetRoutineMaintenance

routeSetRoutineMaintenance

protected ScheduledMessage routeSetRoutineMaintenance
Constructor Detail

DistPastryNode

protected DistPastryNode(NodeId 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
Method Detail

getTimer

public Timer getTimer()

addNetworkListener

public void addNetworkListener(NetworkListener listener)

getNetworkListeners

protected NetworkListener[] getNetworkListeners()

broadcastChannelClosed

public void broadcastChannelClosed(java.net.InetSocketAddress addr)

broadcastChannelOpened

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

broadcastSentListeners

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

broadcastReceivedListeners

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

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)

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

ePOST API

Copyright © 2001-2005 - Rice Pastry.