|
||||||||||
| 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.
| Method Summary | |
|---|---|
static SocketProxy |
create(URL urlOfLocalNode,
URL url)
Establishes a connection from urlOfLocalNode to
url. |
void |
disconnect()
Tells this proxy that it is not needed anymore. |
java.util.List<ResponsibleNode> |
findSuccessor(int tag,
java.lang.String res,
URL url)
Returns the node which is responsible for the given resource. |
Node |
findSuccessorAtFloor(Floor floor,
ID key)
Returns the node which is responsible for the given key at given floor. |
Floor |
getFirstFloor()
|
ID |
getIdForFloor(Floor floor)
|
void |
insertEntry(Floor floor,
Entry entry)
Stores the given object under the given ID at given floor. |
void |
insertReplicas(Floor floor,
java.util.Set<Entry> replicas)
Inserts replicates of the given entries for given floor. |
void |
leavesNetwork(Floor floor,
Node predecessor)
Inform all predecessor of given node that it leaves the network. |
java.util.List<Node> |
notify(Floor floor,
Node potentialPredecessor)
Requests this node's predecessor at given floor in result[0] and successor list in result[1..length-1]. |
RefsAndEntries |
notifyAndCopyEntries(Floor floor,
Node potentialPredecessor)
Requests this node's predecessor, successor list and entries at given floor. |
void |
ping()
Requests a sign of live. |
void |
removeEntry(Floor floor,
Entry entry)
Removes the given object from the list stored under the given ID at given floor. |
void |
removeReplicas(Floor floor,
ID sendingNodeID,
java.util.Set<Entry> replicas)
Removes replicates of the given entries for given floor. |
java.util.Set<Entry> |
retrieveEntries(Floor floor,
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. |
java.lang.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, getNodeURL, hashCode |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| 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.
public Node findSuccessorAtFloor(Floor floor,
ID key)
throws CommunicationException
Node
findSuccessorAtFloor in class Nodekey - floor - Floor at which is searched being held.
key.
CommunicationException
public java.util.List<ResponsibleNode> findSuccessor(int tag,
java.lang.String res,
URL url)
throws CommunicationException
Node
findSuccessor in class Nodetag - Tag for checking is the request is already processed.res - Resource for which the successor is searched for.url - URL of the node which successor is searched for.
CommunicationException
public java.util.List<Node> notify(Floor floor,
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(Floor floor,
Entry entry)
throws CommunicationException
Node
insertEntry in class Nodeentry -
CommunicationException
public void insertReplicas(Floor floor,
java.util.Set<Entry> replicas)
throws CommunicationException
Node
insertReplicas in class Nodereplicas -
CommunicationException
public void leavesNetwork(Floor floor,
Node predecessor)
throws CommunicationException
Node
leavesNetwork in class Nodepredecessor -
CommunicationException
public void removeEntry(Floor floor,
Entry entry)
throws CommunicationException
Node
removeEntry in class Nodeentry -
CommunicationException
public void removeReplicas(Floor floor,
ID sendingNodeID,
java.util.Set<Entry> replicas)
throws CommunicationException
Node
removeReplicas in class NodesendingNodeID - replicas -
CommunicationException
public java.util.Set<Entry> retrieveEntries(Floor floor,
ID id)
throws CommunicationException
Node
retrieveEntries in class NodeSet of entries associated with id.
CommunicationException - Thrown if an unresolvable communication failure occurs.public 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 java.lang.Runnable
public RefsAndEntries notifyAndCopyEntries(Floor floor,
Node potentialPredecessor)
throws CommunicationException
Node
notifyAndCopyEntries in class NodepotentialPredecessor -
Node#notifyAndCopyEntries(Node).
CommunicationExceptionpublic java.lang.String toString()
toString in class Nodepublic ID getIdForFloor(Floor floor)
getIdForFloor in class Node
public Floor getFirstFloor()
throws CommunicationException
getFirstFloor in class NodeCommunicationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||