org.kth.dks.planetlab
Class StrechMeter

java.lang.Object
  extended by java.lang.Thread
      extended by org.kth.dks.planetlab.StrechMeter
All Implemented Interfaces:
java.lang.Runnable, DKSDHTCallback

public class StrechMeter
extends java.lang.Thread
implements DKSDHTCallback


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int pingTimeout
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
StrechMeter(java.lang.String hostname, boolean mysqlGateway, DKSRef mySQLNode)
           
 
Method Summary
 void connectToMySQL()
           
 void dhtBroadcastCallback(DKSObject value)
          Receive a broadcast message
 DKSMessage dhtRouteCallback(long identifier, DKSMessage msg)
          The callback is called at the responsible node when a route() message reaches its destination and the message is not handled at a lower abstraction layer.
 void dhtRouteCallbackAsync(long identifier, DKSMessage msg)
          The callback is called at the responsible node when a route() message reaches its destination and the message is not handled at a lower abstraction layer.
 void insertResultIntoDB(long fromIp, long toIp, int dksRttMs, int ipRttMs, DKSRef from, java.lang.String hostname)
           
 void pingMsgHandler(DKSRef source, PingMsg msg)
           
 void pongMsgHandler(DKSRef source, PongMsg msg)
           
 void run()
           
 int sendDirectPing(DKSRef target)
           
 int sendRandomLookup()
           
 void setThisDKSDHTImpl(DKSDHTImpl DKSnode)
           
 void sleepRandom()
           
 void strechMeasurementMsgHandler(DKSRef source, StrechMeasurementMsg msg)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pingTimeout

public static final int pingTimeout
See Also:
Constant Field Values
Constructor Detail

StrechMeter

public StrechMeter(java.lang.String hostname,
                   boolean mysqlGateway,
                   DKSRef mySQLNode)
Method Detail

setThisDKSDHTImpl

public void setThisDKSDHTImpl(DKSDHTImpl DKSnode)

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

sendRandomLookup

public int sendRandomLookup()

sendDirectPing

public int sendDirectPing(DKSRef target)

pingMsgHandler

public void pingMsgHandler(DKSRef source,
                           PingMsg msg)

pongMsgHandler

public void pongMsgHandler(DKSRef source,
                           PongMsg msg)

strechMeasurementMsgHandler

public void strechMeasurementMsgHandler(DKSRef source,
                                        StrechMeasurementMsg msg)

dhtBroadcastCallback

public void dhtBroadcastCallback(DKSObject value)
Description copied from interface: DKSDHTCallback
Receive a broadcast message

Specified by:
dhtBroadcastCallback in interface DKSDHTCallback

dhtRouteCallback

public DKSMessage dhtRouteCallback(long identifier,
                                   DKSMessage msg)
Description copied from interface: DKSDHTCallback
The callback is called at the responsible node when a route() message reaches its destination and the message is not handled at a lower abstraction layer. It receives a DKSMessage, and returns a possibly new DKSMessage INVARIANT: the implementor of this method SHOULD immediately return, as otherwise the underlying DKSNode cannot process new messagesl, and consequently the method cannot recursively call other methods in the DKSInterface as the DKSNode will not be able to receive response messages. Consider using routeAsync() in DKSInterface.

Specified by:
dhtRouteCallback in interface DKSDHTCallback
Parameters:
identifier - long, the identifier searched for in route, maybe not interesting for the app in many cases.
Returns:
DKSObject the payload to be routed back or null if the message is unhandled

dhtRouteCallbackAsync

public void dhtRouteCallbackAsync(long identifier,
                                  DKSMessage msg)
Description copied from interface: DKSDHTCallback
The callback is called at the responsible node when a route() message reaches its destination and the message is not handled at a lower abstraction layer. It receives a DKSMessage

Specified by:
dhtRouteCallbackAsync in interface DKSDHTCallback
Parameters:
identifier - long, the identifier searched for in route, maybe not interesting for the app in many cases.
msg - DKSObject, the actual payload sent by the source

insertResultIntoDB

public void insertResultIntoDB(long fromIp,
                               long toIp,
                               int dksRttMs,
                               int ipRttMs,
                               DKSRef from,
                               java.lang.String hostname)

connectToMySQL

public void connectToMySQL()

sleepRandom

public void sleepRandom()


Copyright © 2010. All Rights Reserved.