|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--MyChord
Basic Chord implementation. This is a simple implementation that should permit development to progress. The current implementation is not particularly robust to failure, is quite inefficient, and is not scalable. It utilizes a centralised server that will make the timing relationships easier to work with. If there is demand I will attempt to supply a more scalable version with an identical interface. The class uses two different handlers depending on whether it is the master node that retains the list of all nodes or it is a normal node that queries the master node to get information.
| Inner Class Summary | |
protected class |
MyChord.MasterHandler
Inner class to handle one interaction for the master node. |
protected class |
MyChord.StandardHandler
Inner class to handle one interaction for the standard node. |
| Field Summary | |
protected MyChange |
change
|
protected boolean |
closing
|
protected int |
debug
|
protected ChordLocation |
here
|
protected ChordLocation |
master
|
protected java.net.ServerSocket |
servSock
|
| Method Summary | |
protected void |
add(ChordLocation node)
Add adds a node to the list. |
protected void |
delete(ChordLocation node)
Deletes a node from the list when it leaves the ring. |
void |
leave()
We call this when we want to leave the chord ring. |
protected void |
log(java.lang.String s)
Shorthand for a print statement. |
protected int |
lookKey(byte[] key)
LookKey looks up a key in the list of locations. |
ChordLocation |
lookUp(byte[] key)
This looks up a key in the Chord ring. |
protected void |
printNodes()
Used for debugging, this prints an ordered list of nodes. |
void |
runServer()
This is the method that kicks off a server. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected MyChange change
protected ChordLocation here
protected ChordLocation master
protected java.net.ServerSocket servSock
protected int debug
protected boolean closing
| Method Detail |
protected void printNodes()
protected int lookKey(byte[] key)
protected void add(ChordLocation node)
protected void delete(ChordLocation node)
public ChordLocation lookUp(byte[] key)
public void leave()
public void runServer()
protected void log(java.lang.String s)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||