|
ePOST API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.tutorial.lesson6.MyScribeClient
public class MyScribeClient
We implement the Application interface to receive regular timed messages (see lesson5). We implement the ScribeClient interface to receive scribe messages (called ScribeContent).
Field Summary | |
---|---|
protected Endpoint |
endpoint
The Endpoint represents the underlieing node. |
Constructor Summary | |
---|---|
MyScribeClient(Node node)
The constructor for this scribe client. |
Method Summary | |
---|---|
boolean |
anycast(Topic topic,
ScribeContent content)
Called when we receive an anycast. |
void |
childAdded(Topic topic,
NodeHandle child)
Informs this client that a child was added to a topic in which it was interested in. |
void |
childRemoved(Topic topic,
NodeHandle child)
Informs this client that a child was removed from a topic in which it was interested in. |
void |
deliver(Id id,
Message message)
Part of the Application interface. |
void |
deliver(Topic topic,
ScribeContent content)
Called whenever we receive a published message. |
boolean |
forward(RouteMessage message)
This method is invoked on applications when the underlying node is about to forward the given message with the provided target to the specified next hop. |
NodeHandle[] |
getChildren()
|
NodeHandle |
getParent()
|
boolean |
isRoot()
Some passthrough accessors for the myScribe |
void |
sendAnycast()
Sends an anycast message. |
void |
sendMulticast()
Sends the multicast message. |
void |
startPublishTask()
Starts the publish task. |
void |
subscribe()
Subscribes to myTopic. |
void |
subscribeFailed(Topic topic)
Informs the client that a subscribe on the given topic failed - the client should retry the subscribe or take appropriate action. |
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 |
Field Detail |
---|
protected Endpoint endpoint
Constructor Detail |
---|
public MyScribeClient(Node node)
node
- the PastryNodeMethod Detail |
---|
public void subscribe()
public void startPublishTask()
public void deliver(Id id, Message message)
deliver
in interface Application
id
- The destination id of the messagemessage
- The message being sentpublic void sendMulticast()
public void deliver(Topic topic, ScribeContent content)
deliver
in interface ScribeClient
topic
- The topic the message was published tocontent
- The content which was publishedpublic void sendAnycast()
public boolean anycast(Topic topic, ScribeContent content)
anycast
in interface ScribeClient
topic
- The topic the message was anycasted tocontent
- The content which was anycasted
public void childAdded(Topic topic, NodeHandle child)
ScribeClient
childAdded
in interface ScribeClient
topic
- The topic to unsubscribe fromchild
- The child that was addedpublic void childRemoved(Topic topic, NodeHandle child)
ScribeClient
childRemoved
in interface ScribeClient
topic
- The topic to unsubscribe fromchild
- The child that was removedpublic void subscribeFailed(Topic topic)
ScribeClient
subscribeFailed
in interface ScribeClient
topic
- The topic which the subscribe failed onpublic boolean forward(RouteMessage message)
Application
forward
in interface Application
message
- The message being sent, containing an internal message
along with a destination key and nodeHandle next hop.
public 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 boolean isRoot()
public NodeHandle getParent()
public NodeHandle[] getChildren()
|
ePOST API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |