uk.ac.ic.doc.automed.p2p.routing
Class Cresendo

java.lang.Object
  extended by ow.routing.impl.AbstractRoutingAlgorithm
      extended by ow.routing.linearwalker.LinearWalker
          extended by ow.routing.chord.AbstractChord
              extended by uk.ac.ic.doc.automed.p2p.routing.Cresendo
All Implemented Interfaces:
ow.routing.RoutingAlgorithm

public class Cresendo
extends ow.routing.chord.AbstractChord


Nested Class Summary
protected  class Cresendo.DomainStabilizer
           
private  class Cresendo.FingerTableFixer
           
(package private)  class Cresendo.ReqConnectMessageHandler
           
 class Cresendo.ReqFindSuccessorMessageHandler
           
protected  class Cresendo.Stabilizer
           
 
Field Summary
private  CresendoConfiguration config
           
private  ow.messaging.MessagingAddress[] domainLevelNeighbours
           
private  java.lang.Thread fingerTableFixerThread
           
private  java.util.List fingerTableList
           
private  ow.id.IDAddressPair initialContact
           
private  int numberOfHigherDomainLevels
           
private  DHTRoutingState routingState
           
 
Fields inherited from class ow.routing.chord.AbstractChord
fingerTable
 
Fields inherited from class ow.routing.linearwalker.LinearWalker
algorithm, idSizeInBit, predecessor, sizeOfIdSpace, stabilizerThread, stopped, successorList, suspended, towardSelfComparator
 
Fields inherited from class ow.routing.impl.AbstractRoutingAlgorithm
logger, runtime, runtimeConfig, selfIDAddress, sender
 
Constructor Summary
protected Cresendo(ow.routing.RoutingAlgorithmConfiguration config, ow.routing.RoutingService routingSvc)
           
 
Method Summary
private  ow.id.IDAddressPair findSuccessor(ow.id.ID targetID)
          Use the current finger table to find the successor of a given target ID
private  ow.id.IDAddressPair[] findSuccessorByProxy(ow.messaging.MessagingAddress proxyNode, ow.id.ID targetID, java.lang.String[] levels)
          Ask a node to find the successor of an ID for a specified domain level
private  ow.routing.chord.FingerTable getFingerTable(int level)
          Check if there are finger entries for a specified domain level
 java.lang.String getRoutingTableHTMLString()
           
 java.lang.String getRoutingTableHTMLString(ow.routing.chord.FingerTable ft)
           
 java.lang.String getRoutingTableString()
           
 java.lang.String getRoutingTableString(ow.routing.chord.FingerTable ft)
           
private  void initDomainFingerTable(ow.messaging.MessagingAddress domainSuccessor, ow.routing.chord.FingerTable ft)
          Populate a domain finger table with entries, Not all looked up entries are added (Section 2.1 of the paper)
 void join(ow.id.IDAddressPair[] neighbors)
          this is invoked when a node joins an existing node in its lowest-level domain
 void joinDomain(ow.messaging.MessagingAddress[] domainLevelNeighbours)
          This method is invoked to join with peers in other domains (if any).
 void prepareHandlers()
           
 void resume()
           
protected  void startDomainStabilizer()
          Stabilizer for updating the domain hierarchy
private  void startFingerTableFixer()
           
protected  void startStabilizer()
           
 void stop()
           
private  void stopFingerTableFixer()
           
 void suspend()
           
protected  void updateDomainHierarchy(ow.messaging.MessagingAddress proxyNode)
          update the domain hierarchy via a chosen proxy node by sending a query with the current node's ID via this proxy (Section 2.3 of the paper)
private  void updatePredecessor(ow.id.IDAddressPair targetNode)
          Tells the target node that I am his predecessor also use the target node's predessor as my predecessor (Section 2.3 of the paper)
 
Methods inherited from class ow.routing.chord.AbstractChord
closestTo, forget, reset, touch
 
Methods inherited from class ow.routing.linearwalker.LinearWalker
adjustRoot, connectToSuccessor, connectToSuccessorList, distance, join, prepareHandlers, rootCandidates, toReplace, updatePredecessor
 
Methods inherited from class ow.routing.impl.AbstractRoutingAlgorithm
fail, initialRoutingContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

private CresendoConfiguration config

routingState

private DHTRoutingState routingState

fingerTableList

private java.util.List fingerTableList

initialContact

private ow.id.IDAddressPair initialContact

numberOfHigherDomainLevels

private int numberOfHigherDomainLevels

domainLevelNeighbours

private ow.messaging.MessagingAddress[] domainLevelNeighbours

fingerTableFixerThread

private java.lang.Thread fingerTableFixerThread
Constructor Detail

Cresendo

protected Cresendo(ow.routing.RoutingAlgorithmConfiguration config,
                   ow.routing.RoutingService routingSvc)
            throws java.security.InvalidAlgorithmParameterException
Throws:
java.security.InvalidAlgorithmParameterException
Method Detail

join

public void join(ow.id.IDAddressPair[] neighbors)
this is invoked when a node joins an existing node in its lowest-level domain

Specified by:
join in interface ow.routing.RoutingAlgorithm
Overrides:
join in class ow.routing.linearwalker.LinearWalker

joinDomain

public void joinDomain(ow.messaging.MessagingAddress[] domainLevelNeighbours)
This method is invoked to join with peers in other domains (if any). It is invoked by the P2P application. The list of domain level neighbours are provided by an external mean (e.g. DNS)

Specified by:
joinDomain in interface ow.routing.RoutingAlgorithm
Overrides:
joinDomain in class ow.routing.impl.AbstractRoutingAlgorithm
Parameters:
domainLevelNeighbours -

startDomainStabilizer

protected void startDomainStabilizer()
Stabilizer for updating the domain hierarchy


updateDomainHierarchy

protected void updateDomainHierarchy(ow.messaging.MessagingAddress proxyNode)
                              throws DomainUpdateException
update the domain hierarchy via a chosen proxy node by sending a query with the current node's ID via this proxy (Section 2.3 of the paper)

Throws:
DomainUpdateException

initDomainFingerTable

private void initDomainFingerTable(ow.messaging.MessagingAddress domainSuccessor,
                                   ow.routing.chord.FingerTable ft)
                            throws FindSuccessorException
Populate a domain finger table with entries, Not all looked up entries are added (Section 2.1 of the paper)

Parameters:
domainSuccessor -
ft -
Throws:
FindSuccessorException

updatePredecessor

private void updatePredecessor(ow.id.IDAddressPair targetNode)
                        throws java.io.IOException
Tells the target node that I am his predecessor also use the target node's predessor as my predecessor (Section 2.3 of the paper)

Parameters:
targetNode -
Throws:
java.io.IOException

startFingerTableFixer

private void startFingerTableFixer()

stopFingerTableFixer

private void stopFingerTableFixer()

stop

public void stop()
Specified by:
stop in interface ow.routing.RoutingAlgorithm
Overrides:
stop in class ow.routing.linearwalker.LinearWalker

suspend

public void suspend()
Specified by:
suspend in interface ow.routing.RoutingAlgorithm
Overrides:
suspend in class ow.routing.linearwalker.LinearWalker

resume

public void resume()
Specified by:
resume in interface ow.routing.RoutingAlgorithm
Overrides:
resume in class ow.routing.linearwalker.LinearWalker

startStabilizer

protected void startStabilizer()
Overrides:
startStabilizer in class ow.routing.linearwalker.LinearWalker

prepareHandlers

public void prepareHandlers()
Overrides:
prepareHandlers in class ow.routing.linearwalker.LinearWalker

getFingerTable

private ow.routing.chord.FingerTable getFingerTable(int level)
Check if there are finger entries for a specified domain level

Parameters:
level -
Returns:

findSuccessorByProxy

private ow.id.IDAddressPair[] findSuccessorByProxy(ow.messaging.MessagingAddress proxyNode,
                                                   ow.id.ID targetID,
                                                   java.lang.String[] levels)
                                            throws FindSuccessorException
Ask a node to find the successor of an ID for a specified domain level

Parameters:
proxyNode -
targetID -
level -
Returns:
Throws:
FindSuccessorException

findSuccessor

private ow.id.IDAddressPair findSuccessor(ow.id.ID targetID)
                                   throws FindSuccessorException
Use the current finger table to find the successor of a given target ID

Parameters:
targetID -
Returns:
Throws:
FindSuccessorException

getRoutingTableString

public java.lang.String getRoutingTableString()
Specified by:
getRoutingTableString in interface ow.routing.RoutingAlgorithm
Overrides:
getRoutingTableString in class ow.routing.chord.AbstractChord

getRoutingTableString

public java.lang.String getRoutingTableString(ow.routing.chord.FingerTable ft)

getRoutingTableHTMLString

public java.lang.String getRoutingTableHTMLString()
Specified by:
getRoutingTableHTMLString in interface ow.routing.RoutingAlgorithm
Overrides:
getRoutingTableHTMLString in class ow.routing.chord.AbstractChord

getRoutingTableHTMLString

public java.lang.String getRoutingTableHTMLString(ow.routing.chord.FingerTable ft)