|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.tutorial.lookup.LookupService
public class LookupService
The LookupService provides a way to find out what nodes are responsible for a given Id. It does this by routing a request across the ring, doing a replicaSet lookup at the destination, and sending the result back. It is perhaps the simplest useful application.
Nested Class Summary | |
---|---|
static class |
LookupService.NodeLookupQuery
The query message |
static class |
LookupService.NodeLookupResponse
The response message |
static class |
LookupService.NodeLookupTimeout
This is a message used internally for implementing timeouts |
static class |
LookupService.NodeLookupTimeoutException
Returned by continuations handed to requestNodeHandles when a request times out. |
Constructor Summary | |
---|---|
LookupService(Node node)
Build a LookupService application with the default lookup timeout |
|
LookupService(Node node,
long timeout)
Build a LookupService application with a specified timeout |
Method Summary | |
---|---|
void |
deliver(Id id,
Message message)
This method is called on the application at the destination node for the given id. |
boolean |
forward(RouteMessage message)
This Application always forwards its messages |
void |
requestNodeHandle(Id id,
Continuation<NodeHandle,java.lang.Exception> cont)
Find the primary replica of a key. |
void |
requestNodeHandles(Id id,
int num,
Continuation<NodeHandleSet,java.lang.Exception> cont)
Requests a replicaSet from a node across the ring. |
protected void |
sendMessage(int seq,
Id id,
int num,
Continuation<NodeHandleSet,java.lang.Exception> cont,
long timeout)
This does the internal processing for requestNodeHandle(s). |
protected void |
sendMessageWithRetries(Id id,
int num,
Continuation<NodeHandleSet,java.lang.Exception> cont)
|
void |
update(NodeHandle handle,
boolean joined)
This method is invoked to inform the application that the given node has either joined or left the neighbor set of the local node, as the set would be returned by the neighborSet call. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LookupService(Node node, long timeout)
node
- the local nodetimeout
- query timeout in millisecondspublic LookupService(Node node)
node
- the local nodeMethod Detail |
---|
public boolean forward(RouteMessage message)
forward
in interface Application
message
- The message being sent, containing an internal message
along with a destination key and nodeHandle next hop.
Application.forward(rice.p2p.commonapi.RouteMessage)
public void deliver(Id id, Message message)
Application
deliver
in interface Application
id
- The destination id of the messagemessage
- The message being sentpublic void update(NodeHandle handle, boolean joined)
Application
update
in interface Application
handle
- The handle that has joined/leftjoined
- Whether the node has joined or leftpublic void requestNodeHandles(Id id, int num, Continuation<NodeHandleSet,java.lang.Exception> cont)
id
- the Id of interestnum
- the number of nodes to returncont
- the continuation to return the result toprotected void sendMessageWithRetries(Id id, int num, Continuation<NodeHandleSet,java.lang.Exception> cont)
protected void sendMessage(int seq, Id id, int num, Continuation<NodeHandleSet,java.lang.Exception> cont, long timeout)
id
- the Id of interestnum
- the number of nodes to returncont
- the continuation to return the result topublic void requestNodeHandle(Id id, Continuation<NodeHandle,java.lang.Exception> cont)
id
- the Id of interestcont
- the continuation to return the result to
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |