ePOST API

rice.pastry.direct
Class BasicNetworkSimulator

java.lang.Object
  extended by rice.pastry.direct.BasicNetworkSimulator
All Implemented Interfaces:
NetworkSimulator
Direct Known Subclasses:
EuclideanNetwork, GenericNetwork, SphereNetwork

public abstract class BasicNetworkSimulator
extends java.lang.Object
implements NetworkSimulator


Field Summary
protected  Logger logger
           
protected  SelectorManager manager
           
protected  int MIN_DELAY
           
protected  RandomSource random
           
protected  java.util.TreeSet taskQueue
           
 
Constructor Summary
BasicNetworkSimulator(Environment env)
           
 
Method Summary
 ScheduledMessage deliverMessage(Message msg, DirectPastryNode node)
          Deliver message ASAP.
 ScheduledMessage deliverMessage(Message msg, DirectPastryNode node, int delay)
          Deliver message.
 ScheduledMessage deliverMessage(Message msg, DirectPastryNode node, int delay, int period)
          Deliver message.
 ScheduledMessage deliverMessageFixedRate(Message msg, DirectPastryNode node, int delay, int period)
          Deliver message.
 void destroy(DirectPastryNode node)
          set the liveliness of a NodeId
 DirectNodeHandle getClosest(DirectNodeHandle nh)
          find the closest NodeId to an input NodeId out of all NodeIds in the network
 Environment getEnvironment()
           
 TestRecord getTestRecord()
          get TestRecord
 boolean isAlive(DirectNodeHandle nh)
          testing if a NodeId is alive
 int proximity(DirectNodeHandle a, DirectNodeHandle b)
          computes the proximity between two NodeIds
 void registerNode(DirectPastryNode dpn)
          Registers a node handle with the simulator.
 void removeNode(DirectPastryNode node)
           
 void setTestRecord(TestRecord tr)
          set TestRecord
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface rice.pastry.direct.NetworkSimulator
generateNodeRecord
 

Field Detail

taskQueue

protected java.util.TreeSet taskQueue

logger

protected Logger logger

random

protected RandomSource random

MIN_DELAY

protected int MIN_DELAY

manager

protected SelectorManager manager
Constructor Detail

BasicNetworkSimulator

public BasicNetworkSimulator(Environment env)
Method Detail

start

public void start()
Specified by:
start in interface NetworkSimulator

stop

public void stop()

getTestRecord

public TestRecord getTestRecord()
get TestRecord

Specified by:
getTestRecord in interface NetworkSimulator
Returns:
the returned TestRecord

setTestRecord

public void setTestRecord(TestRecord tr)
set TestRecord

Specified by:
setTestRecord in interface NetworkSimulator
Parameters:
tr - input TestRecord

deliverMessage

public ScheduledMessage deliverMessage(Message msg,
                                       DirectPastryNode node)
Description copied from interface: NetworkSimulator
Deliver message ASAP.

Specified by:
deliverMessage in interface NetworkSimulator
Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.

deliverMessage

public ScheduledMessage deliverMessage(Message msg,
                                       DirectPastryNode node,
                                       int delay)
Description copied from interface: NetworkSimulator
Deliver message.

Specified by:
deliverMessage in interface NetworkSimulator
Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.

deliverMessage

public ScheduledMessage deliverMessage(Message msg,
                                       DirectPastryNode node,
                                       int delay,
                                       int period)
Description copied from interface: NetworkSimulator
Deliver message.

Specified by:
deliverMessage in interface NetworkSimulator
Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.
period - to deliver the message after the delay

deliverMessageFixedRate

public ScheduledMessage deliverMessageFixedRate(Message msg,
                                                DirectPastryNode node,
                                                int delay,
                                                int period)
Description copied from interface: NetworkSimulator
Deliver message.

Specified by:
deliverMessageFixedRate in interface NetworkSimulator
Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.
period - to deliver the message after the delay

isAlive

public boolean isAlive(DirectNodeHandle nh)
testing if a NodeId is alive

Specified by:
isAlive in interface NetworkSimulator
Parameters:
nid - the NodeId being tested
Returns:
true if nid is alive false otherwise

destroy

public void destroy(DirectPastryNode node)
set the liveliness of a NodeId

Specified by:
destroy in interface NetworkSimulator
Parameters:
nid - the NodeId being set
alive - the value being set

proximity

public int proximity(DirectNodeHandle a,
                     DirectNodeHandle b)
computes the proximity between two NodeIds

Specified by:
proximity in interface NetworkSimulator
Parameters:
a - the first NodeId
b - the second NodeId
Returns:
the proximity between the two input NodeIds

getClosest

public DirectNodeHandle getClosest(DirectNodeHandle nh)
find the closest NodeId to an input NodeId out of all NodeIds in the network

Specified by:
getClosest in interface NetworkSimulator
Parameters:
nid - the input NodeId
Returns:
the NodeId closest to the input NodeId in the network

registerNode

public void registerNode(DirectPastryNode dpn)
Description copied from interface: NetworkSimulator
Registers a node handle with the simulator.

Specified by:
registerNode in interface NetworkSimulator

removeNode

public void removeNode(DirectPastryNode node)
Specified by:
removeNode in interface NetworkSimulator

getEnvironment

public Environment getEnvironment()
Specified by:
getEnvironment in interface NetworkSimulator

ePOST API

Copyright © 2001-2005 - Rice Pastry.