|
Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectrice.pastry.client.PastryAppl
A PastryAppl is an abstract class that every Pastry application extends. This is the external Pastry API.
| Field Summary | |
protected int |
address
DESCRIBE THE FIELD |
protected MessageDeserializer |
deserializer
DESCRIBE THE FIELD |
protected java.lang.String |
instance
DESCRIBE THE FIELD |
protected Logger |
logger
DESCRIBE THE FIELD |
protected AppSocketReceiver |
receiver
holds the receiverSocket |
protected PastryNode |
thePastryNode
DESCRIBE THE FIELD |
| Constructor Summary | |
PastryAppl(PastryNode pn)
Constructor. |
|
PastryAppl(PastryNode pn,
int port)
Constructor. |
|
PastryAppl(PastryNode pn,
java.lang.String instance)
Constructor. |
|
PastryAppl(PastryNode pn,
java.lang.String instance,
int address,
MessageDeserializer md)
Constructor for PastryAppl. |
|
| Method Summary | |
void |
accept(AppSocketReceiver receiver)
Sets an AppSocketReceiver to be called when the next socket arrives. |
void |
connect(NodeHandle handle,
AppSocketReceiver receiver,
int timeout)
Called to open an ApplicationLevelSocket |
boolean |
deliverWhenNotReady()
Instructs the MessageDispatch how to behave when the PastryNode is not ready. |
void |
destroy()
Called when PastryNode is destroyed. |
boolean |
enrouteMessage(Message msg,
Id key,
NodeHandle nextHop,
SendOptions opt)
Called by pastry when a message is enroute and is passing through this node. |
int |
getAddress()
Returns the address of this application. |
LeafSet |
getLeafSet()
Called by a layered Pastry application to obtain a copy of the leaf set. |
NodeHandle |
getNodeHandle()
Gets the handle of the Pastry node associated with this client |
Id |
getNodeId()
Gets the node id associated with this client. |
RoutingTable |
getRoutingTable()
Called by a layered Pastry application to obtain a copy of the routing table. |
boolean |
isClosest(Id key)
Called by the layered Pastry application to check if the local pastry node is the one that is currently closest to the object key id. |
void |
leafSetChange(NodeHandle nh,
boolean wasAdded)
Called by pastry when the leaf set changes. |
abstract void |
messageForAppl(Message msg)
Called by pastry when a message arrives for this application. |
void |
notifyReady()
Invoked when the Pastry node has joined the overlay network and is ready to send and receive messages As of FreePastry 1.4.1, replaced by PastryNode Observer pattern. |
void |
receiveMessage(Message msg)
Called by pastry to deliver a message to this client. |
void |
receiveMessageInternal(RawMessageDelivery msg)
DESCRIBE THE METHOD |
boolean |
receiveSocket(AppSocket socket)
Calls receiver.receiveSocket(), then sets receiver to null. |
void |
register()
DESCRIBE THE METHOD |
void |
routeMsg(Id key,
Message msg,
SendOptions opt)
Routes a message to the live node D with nodeId numerically closest to key (at the time of delivery). |
boolean |
routeMsgDirect(NodeHandle dest,
Message msg,
SendOptions opt)
Sends a message to the Pastry node identified by dest. |
void |
routeSetChange(NodeHandle nh,
boolean wasAdded)
Called by pastry when the route set changes. |
protected void |
setDeserializer(MessageDeserializer deserializer)
Sets the Deserializer attribute of the PastryAppl object |
void |
update(java.util.Observable arg0,
java.lang.Object arg1)
DESCRIBE THE METHOD |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected MessageDeserializer deserializer
protected java.lang.String instance
protected PastryNode thePastryNode
protected int address
protected Logger logger
protected AppSocketReceiver receiver
| Constructor Detail |
public PastryAppl(PastryNode pn)
pn - the pastry node that client will attach to.
public PastryAppl(PastryNode pn,
java.lang.String instance)
pn - the pastry node that client will attach to.instance - The instance name of this appl.
public PastryAppl(PastryNode pn,
java.lang.String instance,
int address,
MessageDeserializer md)
pn - DESCRIBE THE PARAMETERinstance - DESCRIBE THE PARAMETERaddress - DESCRIBE THE PARAMETERmd - DESCRIBE THE PARAMETER
public PastryAppl(PastryNode pn,
int port)
pn - the pastry node that client will attach to.port - DESCRIBE THE PARAMETER| Method Detail |
public int getAddress()
public final Id getNodeId()
public NodeHandle getNodeHandle()
public LeafSet getLeafSet()
public RoutingTable getRoutingTable()
public boolean isClosest(Id key)
key - the object key id
protected void setDeserializer(MessageDeserializer deserializer)
deserializer - The new Deserializer valuepublic void register()
public void receiveMessageInternal(RawMessageDelivery msg)
msg - DESCRIBE THE PARAMETERpublic void receiveMessage(Message msg)
msg - the message that is arriving.
public void update(java.util.Observable arg0,
java.lang.Object arg1)
update in interface java.util.Observerarg0 - DESCRIBE THE PARAMETERarg1 - DESCRIBE THE PARAMETER
public boolean routeMsgDirect(NodeHandle dest,
Message msg,
SendOptions opt)
dest - the destination nodemsg - the message to deliver.opt - send options that describe how the message is to be routed.
public void routeMsg(Id key,
Message msg,
SendOptions opt)
key - the keymsg - the message to deliver.opt - send options that describe how the message is to be routed.public abstract void messageForAppl(Message msg)
msg - the message that is arriving.
public boolean enrouteMessage(Message msg,
Id key,
NodeHandle nextHop,
SendOptions opt)
msg - the message that is passing through.key - the keynextHop - the default next hop for the message.opt - the send options the message was sent with.
public void leafSetChange(NodeHandle nh,
boolean wasAdded)
nh - the handle of the node that was added or removed.wasAdded - true if the node was added, false if the node was removed.
public void routeSetChange(NodeHandle nh,
boolean wasAdded)
nh - the handle of the node that was added or removed.wasAdded - true if the node was added, false if the node was removed.public void notifyReady()
public boolean deliverWhenNotReady()
public void destroy()
public void connect(NodeHandle handle,
AppSocketReceiver receiver,
int timeout)
handle - DESCRIBE THE PARAMETERreceiver - DESCRIBE THE PARAMETERtimeout - DESCRIBE THE PARAMETERpublic void accept(AppSocketReceiver receiver)
receiver - public boolean receiveSocket(AppSocket socket)
socket - the new socket from the network
|
Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||