|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.uniba.wiai.lspi.chord.com.Node
de.uniba.wiai.lspi.chord.com.Proxy
de.uniba.wiai.lspi.chord.com.local.ThreadProxy
public final class ThreadProxy
This class represents a Proxy for the protocol that allows
to be build a (local) chord network within one JVM.
| Field Summary | |
|---|---|
protected URL |
creatorURL
The URLof the node that created this proxy. |
protected boolean |
hasBeenUsed
Indicates if this proxy has been used to make a invocation. |
protected boolean |
isValid
Indicates if this proxy can be used for communication; |
protected Registry |
registry
Reference to the registrysingleton. |
| Fields inherited from class de.uniba.wiai.lspi.chord.com.Node |
|---|
nodeID, nodeURL |
| Constructor Summary | |
|---|---|
ThreadProxy(URL creatorURL1,
URL url)
Creates a Proxy for the jchordlocal protocol. |
|
| Method Summary | |
|---|---|
void |
disconnect()
Closes the connection to the node. |
Node |
findSuccessor(ID key)
Returns the Chord node which is responsible for the given key. |
ThreadEndpoint |
getEndpoint()
Get a reference to the endpoint this proxy
delegates methods to. |
void |
insertEntry(Entry entry)
Stores the given object under the given ID. |
void |
insertReplicas(Set<Entry> entries)
Inserts replicates of the given entries. |
void |
invalidate()
Invalidates this proxy. |
boolean |
isValid()
Test if this Proxy is valid. |
void |
leavesNetwork(Node predecessor)
Inform a node that its predecessor leaves the network. |
List<Node> |
notify(Node potentialPredecessor)
Requests this node's predecessor in result[0] and successor list in result[1..length-1]. |
RefsAndEntries |
notifyAndCopyEntries(Node potentialPredecessor)
Requests this node's predecessor, successor list and entries. |
void |
ping()
Requests a sign of live. |
void |
removeEntry(Entry entry)
Removes the given object from the list stored under the given ID. |
void |
removeReplicas(ID sendingNodeID,
Set<Entry> entriesToRemove)
Removes replicates of the given entries. |
Set<Entry> |
retrieveEntries(ID id)
Returns all entries stored under the given ID. |
String |
toString()
|
| Methods inherited from class de.uniba.wiai.lspi.chord.com.Proxy |
|---|
createConnection |
| Methods inherited from class de.uniba.wiai.lspi.chord.com.Node |
|---|
equals, getNodeID, getNodeURL, hashCode, setNodeID, setNodeURL |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Registry registry
registrysingleton.
protected URL creatorURL
URLof the node that created this proxy.
protected boolean isValid
protected boolean hasBeenUsed
| Constructor Detail |
|---|
public ThreadProxy(URL creatorURL1,
URL url)
throws CommunicationException
jchordlocal protocol. The host
name part of urlis the name of the node in the
jchordlocal protocol.
creatorURL1 - url - The URLof the node this proxy represents.
CommunicationException| Method Detail |
|---|
public boolean isValid()
true if this Proxy is valid.public void invalidate()
public ThreadEndpoint getEndpoint()
throws CommunicationException
endpoint this proxy
delegates methods to. If there is no endpoint a
exception is thrown.
endpoint this proxy
delegates methods to.
CommunicationException - If there is no endpoint this exception is thrown.
public Node findSuccessor(ID key)
throws CommunicationException
Node
findSuccessor in class Nodekey - Key for which the successor is searched for.
CommunicationException - Thrown if an unresolvable communication failure occurs.
public void insertEntry(Entry entry)
throws CommunicationException
Node
insertEntry in class NodeCommunicationException - Thrown if an unresolvable communication failure occurs.
public void removeEntry(Entry entry)
throws CommunicationException
Node
removeEntry in class Nodeentry - The entry to remove from the dht.
CommunicationException - Thrown if an unresolvable communication failure occurs.public String toString()
toString in class Node
public List<Node> notify(Node potentialPredecessor)
throws CommunicationException
Node
notify in class NodeCommunicationException - Thrown if an unresolvable communication failure occurs.
public void ping()
throws CommunicationException
Node
ping in class NodeCommunicationException - Thrown if an unresolvable communication failure occurs.
public Set<Entry> retrieveEntries(ID id)
throws CommunicationException
Node
retrieveEntries in class NodeSet of entries associated with id.
CommunicationException - Thrown if an unresolvable communication failure occurs.
public void leavesNetwork(Node predecessor)
throws CommunicationException
Node
leavesNetwork in class NodeCommunicationException - Thrown if an unresolvable communication failure occurs.
public void removeReplicas(ID sendingNodeID,
Set<Entry> entriesToRemove)
throws CommunicationException
Node
removeReplicas in class NodesendingNodeID - ID of sending node; if entriesToRemove is empty, all replicas
with ID smaller than the sending node's ID are removedentriesToRemove - Replicas to remove; if empty, all replicas with ID smaller
than the sending node's ID are removed
CommunicationException - Thrown if an unresolvable communication failure occurs.
public void insertReplicas(Set<Entry> entries)
throws CommunicationException
Node
insertReplicas in class Nodeentries - The entries that are replicated.
CommunicationException - Thrown if an unresolvable communication failure occurs.
public RefsAndEntries notifyAndCopyEntries(Node potentialPredecessor)
throws CommunicationException
Node
notifyAndCopyEntries in class NodepotentialPredecessor - Remote node which invokes this method
CommunicationExceptionpublic void disconnect()
Node
disconnect in class Node
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||