edu.virginia.cs.mng.hypercast.DT
Class DT_Node_ServerJoin

java.lang.Object
  |
  +--edu.virginia.cs.mng.hypercast.DT.DT_Node
        |
        +--edu.virginia.cs.mng.hypercast.DT.DT_Node_ServerJoin

public class DT_Node_ServerJoin
extends DT_Node

This class extends the basic Delaunay triangulation node to provide a mechanism for joining a overlay or resolving partitions through a server.

Partition solving and Joins are initiated by the node sending a ServerRequest message to the Server. The server responds by sending a ServerReply message back to the node.

The NewNode message will be routed on the topology to the node in the overlay that is very close to the joining node by compass routing. That node will then send attempt to add the new node as a neighbor.


Field Summary
static float BACKOFF_RATIO
          When server does not respond, ratio of backoff.
private  int backoffCounter
          Counter for exponential backoff.
static int DEAD
          Node state
static int INCOMPLETE
          Node state
static int JOINING
          Node state
static int LEADER_INCOMPLETE
          Node state
static int LEADER_STABLE
          Node state
private  long MAX_SERVER_TIME
          In milliseconds, the maximum server heartbeat time before a backup server is tried.
static long MAX_SERVER_TIME_DEFAULT
          String for the maximum server delay before trying a backup server.
static java.lang.String MAX_SERVER_TIME_PROPERTY_NAME
          Name of property controlling the maximum server delay before trying a backup server.
private  long MIN_SERVER_TIME
          In milliseconds, the default server heartbeat time.
static long MIN_SERVER_TIME_DEFAULT
          String for the default server heartbeat time.
static java.lang.String MIN_SERVER_TIME_PROPERTY_NAME
          Name of property controlling the default server heartbeat time.
private  int sendAttempts
          Number of Attempts to send message to server.
static int SERVER_TIMER_INDEX
          Adapter timer index used for server heartbeat.
private  int serverIndex
          The index of the server being sent to.
private  boolean serverSaidThisWasLeader
          True, if at time of last receive, Server thought this was the Leader.
private  boolean serverTimerCleared
          Used to coordinate resetting and clearing of the server timer.
static int STABLE
          Node state
private  long timeOfLastReceive
          Time the last message was received from the server.
static int UNCONFIRMED_LEADER_INCOMPLETE
          Node state
static int UNCONFIRMED_LEADER_STABLE
          Node state
static boolean USE_NEW_NODE_MESSAGES
          Used to turn on and off the use of NewNode messages.
 
Fields inherited from class edu.virginia.cs.mng.hypercast.DT.DT_Node
adapter, bandwidthCheckpoints, config, FAST_HEARTBEAT_TIME, FAST_HEARTBEAT_TIME_DEFAULT, FAST_HEARTBEAT_TIME_PROPERTY_NAME, HEARTBEAT_TIMER_INDEX, HeartbeatSetToFastHeartbeat, joined, lastChangeToNeighborhood, maxReceiveRateInAHeartbeat, maxSendRateInAHeartbeat, MessageCallBackDebug, messagesReceivedInLastHeartbeat, messagesSentInLastHeartbeat, neighborhood, NODE_COORDS_DEFAULT, NODE_COORDS_PROPERTY_NAME, rand, SLOW_HEARTBEAT_TIME, SLOW_HEARTBEAT_TIME_DEFAULT, SLOW_HEARTBEAT_TIME_PROPERTY_NAME, StableAtHeartbeat, startStopLock, startTime, stopper, stopTime, timeOfLastHeartbeat, TIMEOUT_TIME, TIMEOUT_TIME_DEFAULT, TIMEOUT_TIME_PROPERTY_NAME, TimerCallBackDebug, timerCleared
 
Constructor Summary
DT_Node_ServerJoin(OverlaySocketConfig c, I_UnicastAdapter a)
           
DT_Node_ServerJoin(OverlaySocketConfig c, I_UnicastAdapter a, DT_LogicalAddress startingCoords)
           
 
Method Summary
protected  void changeServerTimerToTime(long newTime)
           
 java.lang.String[] getSchema()
          Part of I_Stats interface.
private  int getState()
          Returns the current state of the node.
 java.lang.String getStats(java.lang.String name)
          Part of I_Stats interface.
private  void handleServerReply(DT_Message m)
          Performs actions for the ServerReply message.
 void joinGroup()
          Joins overlay multicast overlay.
 void leaveGroup()
          Leaves overlay multicast Overlay.
 void messageArrivedFromAdapter(I_Message a)
          I_AdapterCallBack function.
protected  void sendToServer(byte packet_type)
          Sends a message of specified type to the server.
 void setStats(java.lang.String name, java.lang.String value)
          Part of I_Stats interface.
 void timerExpired(int timer_index)
          Handles timer events, such as when the Leader sends a message to the server.
 
Methods inherited from class edu.virginia.cs.mng.hypercast.DT.DT_Node
changeSlowHeartbeatToFastHeartbeat, createLogicalAddress, createLogicalAddress, deleteNeighbor, getAllNeighbors, getChildren, getMyAddressPair, getNextHopToLeader, getParent, goodbyeAllNeighbors, handleGoodbye, handleHello, handleNewNode, handleNodePing, handleTimeoutTimer, helloAllNeighbors, isCandidateNeighbor, isLeader, restoreMessage, sendGoodbyeMessage, sendHelloNeighborMessage, sendHelloNotNeighborMessage, sendHellosToCandidateNeighbors, sendNewNodeMessage, sendTestMessage
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

MIN_SERVER_TIME_DEFAULT

public static final long MIN_SERVER_TIME_DEFAULT
String for the default server heartbeat time.

MIN_SERVER_TIME_PROPERTY_NAME

public static final java.lang.String MIN_SERVER_TIME_PROPERTY_NAME
Name of property controlling the default server heartbeat time.

MAX_SERVER_TIME_DEFAULT

public static final long MAX_SERVER_TIME_DEFAULT
String for the maximum server delay before trying a backup server.

MAX_SERVER_TIME_PROPERTY_NAME

public static final java.lang.String MAX_SERVER_TIME_PROPERTY_NAME
Name of property controlling the maximum server delay before trying a backup server.

SERVER_TIMER_INDEX

public static final int SERVER_TIMER_INDEX
Adapter timer index used for server heartbeat.

BACKOFF_RATIO

public static final float BACKOFF_RATIO
When server does not respond, ratio of backoff.

USE_NEW_NODE_MESSAGES

public static final boolean USE_NEW_NODE_MESSAGES
Used to turn on and off the use of NewNode messages.

JOINING

public static final int JOINING
Node state

STABLE

public static final int STABLE
Node state

LEADER_STABLE

public static final int LEADER_STABLE
Node state

INCOMPLETE

public static final int INCOMPLETE
Node state

LEADER_INCOMPLETE

public static final int LEADER_INCOMPLETE
Node state

UNCONFIRMED_LEADER_STABLE

public static final int UNCONFIRMED_LEADER_STABLE
Node state

UNCONFIRMED_LEADER_INCOMPLETE

public static final int UNCONFIRMED_LEADER_INCOMPLETE
Node state

DEAD

public static final int DEAD
Node state

MIN_SERVER_TIME

private long MIN_SERVER_TIME
In milliseconds, the default server heartbeat time.

MAX_SERVER_TIME

private long MAX_SERVER_TIME
In milliseconds, the maximum server heartbeat time before a backup server is tried.

serverTimerCleared

private boolean serverTimerCleared
Used to coordinate resetting and clearing of the server timer.

serverIndex

private int serverIndex
The index of the server being sent to. 0 = primary, 1 = backup, 2 = second backup, 3 = third backup, etc.

sendAttempts

private int sendAttempts
Number of Attempts to send message to server.

backoffCounter

private int backoffCounter
Counter for exponential backoff.

timeOfLastReceive

private long timeOfLastReceive
Time the last message was received from the server.

serverSaidThisWasLeader

private boolean serverSaidThisWasLeader
True, if at time of last receive, Server thought this was the Leader.
Constructor Detail

DT_Node_ServerJoin

public DT_Node_ServerJoin(OverlaySocketConfig c,
                          I_UnicastAdapter a,
                          DT_LogicalAddress startingCoords)

DT_Node_ServerJoin

public DT_Node_ServerJoin(OverlaySocketConfig c,
                          I_UnicastAdapter a)
Method Detail

joinGroup

public void joinGroup()
Joins overlay multicast overlay.
Overrides:
joinGroup in class DT_Node

leaveGroup

public void leaveGroup()
Leaves overlay multicast Overlay.
Overrides:
leaveGroup in class DT_Node

messageArrivedFromAdapter

public void messageArrivedFromAdapter(I_Message a)
I_AdapterCallBack function. It handles all messages from the server and passes all other messages on to DT_Node.messageArrivedFromAdapter.
Overrides:
messageArrivedFromAdapter in class DT_Node

handleServerReply

private void handleServerReply(DT_Message m)
Performs actions for the ServerReply message. (i.e. attempts to add the Leader as a neighbor.)

sendToServer

protected void sendToServer(byte packet_type)
Sends a message of specified type to the server.

changeServerTimerToTime

protected final void changeServerTimerToTime(long newTime)

timerExpired

public void timerExpired(int timer_index)
Handles timer events, such as when the Leader sends a message to the server. It does call super.handleTimer() to take care of other timer events.
Overrides:
timerExpired in class DT_Node

getState

private int getState()
Returns the current state of the node. State is one of: JOINING, STABLE, LEADER_STABLE, INCOMPLETE, or LEADER_INCOMPLETE.

getStats

public java.lang.String getStats(java.lang.String name)
                          throws StatsException
Part of I_Stats interface.
Overrides:
getStats in class DT_Node
See Also:
I_Stats.getStats(java.lang.String)

setStats

public void setStats(java.lang.String name,
                     java.lang.String value)
              throws StatsException
Part of I_Stats interface.
Overrides:
setStats in class DT_Node
See Also:
I_Stats.setStats(java.lang.String, java.lang.String)

getSchema

public java.lang.String[] getSchema()
                             throws StatsException
Part of I_Stats interface.
Overrides:
getSchema in class DT_Node
See Also:
I_Stats.getSchema()