|
${header} | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
meteor.dht.chord.ChordServiceImpl
The implementation of the DHT service providing an implementation for the DHT querying
| Field Summary | |
java.lang.String |
handlerName
|
net.jxta.peergroup.PeerGroup |
peergroup
|
static java.lang.String |
refModuleSpecID
|
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Fields inherited from interface meteor.dht.chord.ChordService |
refModuleClassID |
| Fields inherited from interface net.jxta.platform.Module |
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_OK |
| Constructor Summary | |
ChordServiceImpl()
Constructor for the DHT service implementation |
|
| Method Summary | |
void |
addListener(DHTListener listener)
Add a listener to this class. |
void |
blockOnSend()
Synchronization for the Messaging between peers |
void |
bootstrap(java.lang.String peerID)
Start the bootstrapping |
void |
checkPredecessor()
Checks if predecessor is alive If not remove the current predecessor |
java.math.BigInteger |
closest_preceding_node(java.math.BigInteger id)
If the id of the successor of the node we are at is between this identifier and the desired identifier return this node |
void |
discoveryEvent(net.jxta.discovery.DiscoveryEvent e)
Is called when a discovery message is received Used ONLY during the bootstrap protocol |
java.math.BigInteger |
find_predecessor(java.math.BigInteger id,
int mode,
int owner)
Find the predecessor of a node id This is used in the update_others protocol, during stabilization and is part of a test shell command findpredecessor. |
void |
find_successor(QueryMessage query)
The query contains the target identifier to look for If this identifier is visible from this node's finger table then it updates its finger table just as a fix_finger routine The forwarding of the query in the process of finding the successor is defined in MessageHandler.processQuery not in find_successor because it is the responsibility of the messaging to forward queries this may seem confusing as it differs a bit from Chord's pseudocode. |
void |
fix_fingers()
Periodically fix fingers by finding successor of the next identifier (n+1,2,4,8,16 etc...) |
void |
get(java.lang.String key)
Hashtable primitive to retrieve an entry from the table |
FingerTable |
getFingerTable()
|
net.jxta.document.Advertisement |
getImplAdvertisement()
Get the Implemetation advertisement |
net.jxta.service.Service |
getInterface()
|
java.math.BigInteger |
getNodeID(java.lang.String id)
Hashes the JXTA peer id into an overlay node id |
java.math.BigInteger |
getTopologySize()
Returns the size of the topoloy as an Integer In the case of a ring, the size of the ring, In the case of a mesh, the width ot th mesh |
boolean |
inInterval(java.math.BigInteger id,
java.math.BigInteger begin,
java.math.BigInteger end,
boolean incLeft,
boolean incRight)
Checks whether id is in the interval [begin,end] or (begin,end) depending on the boolean inclusive |
void |
init_finger_table(java.math.BigInteger bootstrap)
Initializes the finger table of this node before starting the stabilization protocol Sequence of things done: finger[0].node= bootstrap.find_successor(finger[0].start) predecessor = successor.predecessor successor.predecessor = this for i=0 to m if(finger[i+1].start E [this,finger[i].node)) finger[i+1].node=finger[i].node else finger[i+1].node=bootstrap.find_successor(finger[i+1].start) |
void |
init(net.jxta.peergroup.PeerGroup group,
net.jxta.id.ID assignedID,
net.jxta.document.Advertisement implAdv)
Invoked when the service is added to the peergroup in the Loader class. |
boolean |
isLocal(java.math.BigInteger id)
Looks up the local finger table and returns true if the id is present |
void |
join(java.lang.String bootstrap)
The JOIN protocol If the target is identical to the local ID i.e. |
int |
log2(java.math.BigInteger x)
Log base 2 |
void |
lookup(java.math.BigInteger target,
int owner)
Lookup the successor of an identifier. |
void |
lookup(java.math.BigInteger target,
int owner,
int mode)
Lookup the successor of an identifier |
void |
lookup(java.math.BigInteger target,
int owner,
java.lang.String squidQuery)
Lookup the successor of an identifier with a SquidQuery |
void |
notify(java.math.BigInteger id)
Notify successor that this node may be its predecessor |
void |
notifyReceived()
Invoked in messageHandler's processResponse to notify the lookup Service that a response for its blocking query has just been received, and the response identifier of the query set as successor ID. |
void |
put(java.lang.String key,
java.lang.String value)
Hashtable primitive to insert an element in the table |
void |
receivedDHTEntry(QueryMessage query)
Received a DHT Entry |
void |
receivedPingMessage()
Received a Ping Message from predecessor |
void |
receivedPredecessor(java.math.BigInteger predecessor)
When a predecessor query is answered this method is invoked from the MessageHandler processResponse. |
void |
receivedQuery(QueryMessage query)
Received a Squid Query message |
void |
receivedStringMessage(QueryMessage resp)
Processing simple String messages |
void |
receivedSuccessor(QueryMessage responseMessage)
This method is invoked from the MessageHandler processResponse. |
void |
removeListener(DHTListener listener)
Remove a listener |
void |
rendezvousEvent(net.jxta.rendezvous.RendezvousEvent event)
Raised on Rendezvous Event |
void |
run()
Start the thread running periodically Stabilization and finger fixing protocols |
void |
setTopologySize(int s)
Set the size of the topology For a ring, the size of the ring For a mesh, the width of the mesh |
void |
stabilize_fingers()
Update the fingertable on a predecessor reset event |
void |
stabilize_others(QueryMessage q)
When a node has failed and is detected the stabilization protocol sends updates around the ring to other nodes starting from its predecessor |
void |
stabilize()
Stabilization protocol This routine is invoked periodically at a rate defined in the run method by the variable RATE. |
int |
startApp(java.lang.String[] args)
Invoked when calling peergroup.startApps in Loader class. |
void |
stopApp()
Invoked when application stops |
void |
update_finger_table(QueryMessage qm)
UPdate finger table if (s E [n,finger[i].node)) finger[i].node = s p=predecessor p.update_finger_table(s,i) |
void |
update_others()
Updates all nodes that might point to this current node p=find_predecessor(n-2^(i-1)) p.update_finger_table(n,i) |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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 |
public static final java.lang.String refModuleSpecID
public net.jxta.peergroup.PeerGroup peergroup
public java.lang.String handlerName
| Constructor Detail |
public ChordServiceImpl()
| Method Detail |
public net.jxta.document.Advertisement getImplAdvertisement()
getImplAdvertisement in interface net.jxta.service.Servicepublic net.jxta.service.Service getInterface()
getInterface in interface net.jxta.service.Servicepublic void addListener(DHTListener listener)
addListener in interface ChordServicepublic void removeListener(DHTListener listener)
removeListener in interface ChordService
public void init(net.jxta.peergroup.PeerGroup group,
net.jxta.id.ID assignedID,
net.jxta.document.Advertisement implAdv)
throws net.jxta.exception.PeerGroupException
init in interface net.jxta.platform.Modulegroup - the peergroup to which this implementaiton belongsimplAdv - the implementaiton advertisement for this module
net.jxta.exception.PeerGroupExceptionpublic int startApp(java.lang.String[] args)
startApp in interface net.jxta.platform.Modulepublic void stopApp()
stopApp in interface net.jxta.platform.Modulepublic void setTopologySize(int s)
setTopologySize in interface DHTServicepublic java.math.BigInteger getTopologySize()
DHTService
getTopologySize in interface DHTServicepublic FingerTable getFingerTable()
getFingerTable in interface ChordServicepublic java.math.BigInteger getNodeID(java.lang.String id)
DHTService
getNodeID in interface DHTServicepublic int log2(java.math.BigInteger x)
log2 in interface ChordServicepublic void bootstrap(java.lang.String peerID)
bootstrap in interface DHTServicepublic void discoveryEvent(net.jxta.discovery.DiscoveryEvent e)
discoveryEvent in interface net.jxta.discovery.DiscoveryListenerpublic void join(java.lang.String bootstrap)
join in interface DHTServicepublic void init_finger_table(java.math.BigInteger bootstrap)
init_finger_table in interface ChordServicepublic void update_others()
update_others in interface ChordServicepublic void update_finger_table(QueryMessage qm)
update_finger_table in interface ChordService
public void lookup(java.math.BigInteger target,
int owner)
lookup in interface ChordService
public void lookup(java.math.BigInteger target,
int owner,
int mode)
lookup in interface DHTService
public void lookup(java.math.BigInteger target,
int owner,
java.lang.String squidQuery)
lookup in interface ChordServicepublic void find_successor(QueryMessage query)
find_successor in interface ChordServicequery - the QueryMessage defining the Target ID, the Local ID etc...
public java.math.BigInteger find_predecessor(java.math.BigInteger id,
int mode,
int owner)
find_predecessor in interface ChordServiceid - the node identifier to find the predecessor ofmode - the mode in which the query is to be sent SYNCH or ASYNCHowner - the Owner of the query, USER or CHORD
public java.math.BigInteger closest_preceding_node(java.math.BigInteger id)
closest_preceding_node in interface ChordService
public boolean inInterval(java.math.BigInteger id,
java.math.BigInteger begin,
java.math.BigInteger end,
boolean incLeft,
boolean incRight)
inInterval in interface ChordServicepublic boolean isLocal(java.math.BigInteger id)
isLocal in interface ChordServicepublic void stabilize()
stabilize in interface ChordServicepublic void notify(java.math.BigInteger id)
notify in interface ChordServicepublic void receivedPredecessor(java.math.BigInteger predecessor)
receivedPredecessor in interface ChordServicepredecessor - the returned predecessor ID from this node's successorpublic void receivedSuccessor(QueryMessage responseMessage)
receivedSuccessor in interface ChordServicepublic void receivedQuery(QueryMessage query)
public void receivedDHTEntry(QueryMessage query)
public void receivedPingMessage()
public void receivedStringMessage(QueryMessage resp)
public void blockOnSend()
blockOnSend in interface ChordServicepublic void notifyReceived()
notifyReceived in interface ChordServicepublic void fix_fingers()
fix_fingers in interface ChordServicepublic void checkPredecessor()
checkPredecessor in interface ChordServicepublic void stabilize_fingers()
public void stabilize_others(QueryMessage q)
public void run()
run in interface java.lang.Runnablepublic void rendezvousEvent(net.jxta.rendezvous.RendezvousEvent event)
rendezvousEvent in interface net.jxta.rendezvous.RendezvousListener
public void put(java.lang.String key,
java.lang.String value)
put in interface DHTServicepublic void get(java.lang.String key)
get in interface DHTService
|
${header} | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||