|
|||||||||
| 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.socket.SocketProxy
public final class SocketProxy
This is the implementation of Proxy for the socket protocol. This
connects to the endpoint of the node it represents by
means of Sockets.
| Field Summary |
|---|
| Fields inherited from class de.uniba.wiai.lspi.chord.com.Node |
|---|
nodeID, nodeURL |
| Constructor Summary | |
|---|---|
protected |
SocketProxy(URL url,
URL urlOfLocalNode1,
ID nodeID1)
Corresponding constructor to factory method create(URL, URL, ID). |
| Method Summary | |
|---|---|
static SocketProxy |
create(URL urlOfLocalNode,
URL url)
Establishes a connection from urlOfLocalNode to
url. |
protected static SocketProxy |
create(URL url,
URL urlOfLocalNode,
ID nodeID)
Creates a SocketProxy representing the connection from
urlOfLocalNode to url. |
void |
disconnect()
Tells this proxy that it is not needed anymore. |
protected void |
finalize()
Finalization ensures that the socket is closed if this proxy is not needed anymore. |
Node |
findSuccessor(ID key)
Returns the Chord node which is responsible for the given key. |
void |
insertEntry(Entry entry)
Stores the given object under the given ID. |
void |
insertReplicas(Set<Entry> replicas)
Inserts replicates of the given entries. |
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> replicas)
Removes replicates of the given entries. |
Set<Entry> |
retrieveEntries(ID id)
Returns all entries stored under the given ID. |
void |
run()
The run methods waits for incoming Response made by this proxy
and puts them into a datastructure from where the can be collected by the
associated method call that made a
Request to the Node,
that this is the proxy for. |
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, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected SocketProxy(URL url,
URL urlOfLocalNode1,
ID nodeID1)
create(URL, URL, ID).
url - urlOfLocalNode1 - nodeID1 - create(URL, URL, ID)| Method Detail |
|---|
public static SocketProxy create(URL urlOfLocalNode,
URL url)
throws CommunicationException
urlOfLocalNode to
url. The connection is represented by the returned
SocketProxy.
url - The URL to connect to.urlOfLocalNode - URL of local node that establishes the connection.
SocketProxy representing the established
connection.
CommunicationException - Thrown if establishment of connection to url
failed.
protected static SocketProxy create(URL url,
URL urlOfLocalNode,
ID nodeID)
SocketProxy representing the connection from
urlOfLocalNode to url. The connection is
established when the first (remote) invocation with help of the
SocketProxy occurs.
url - The URL of the remote node.urlOfLocalNode - The URL of local node.nodeID - The ID of the remote node.
public Node findSuccessor(ID key)
throws CommunicationException
Node
findSuccessor in class Nodekey -
key.
CommunicationException
public List<Node> notify(Node potentialPredecessor)
throws CommunicationException
Node
notify in class NodepotentialPredecessor -
Node.notify(Node).
CommunicationException - Thrown if an unresolvable communication failure occurs.
public void ping()
throws CommunicationException
Node
ping in class NodeCommunicationException
public void insertEntry(Entry entry)
throws CommunicationException
Node
insertEntry in class Nodeentry -
CommunicationException
public void insertReplicas(Set<Entry> replicas)
throws CommunicationException
Node
insertReplicas in class Nodereplicas -
CommunicationException
public void leavesNetwork(Node predecessor)
throws CommunicationException
Node
leavesNetwork in class Nodepredecessor -
CommunicationException
public void removeEntry(Entry entry)
throws CommunicationException
Node
removeEntry in class Nodeentry -
CommunicationException
public void removeReplicas(ID sendingNodeID,
Set<Entry> replicas)
throws CommunicationException
Node
removeReplicas in class NodesendingNodeID - replicas -
CommunicationException
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.
protected void finalize()
throws Throwable
finalize in class ObjectThrowablepublic void disconnect()
disconnect in class Nodepublic void run()
Response made by this proxy
and puts them into a datastructure from where the can be collected by the
associated method call that made a
Request to the Node,
that this is the proxy for.
run in interface Runnable
public RefsAndEntries notifyAndCopyEntries(Node potentialPredecessor)
throws CommunicationException
Node
notifyAndCopyEntries in class NodepotentialPredecessor -
Node.notifyAndCopyEntries(Node).
CommunicationExceptionpublic String toString()
toString in class Node
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||