Rice Pastry API

rice.pastry.socket.nat.rendezvous
Class RendezvousApp

java.lang.Object
  extended by rice.pastry.client.PastryAppl
      extended by rice.pastry.socket.nat.rendezvous.RendezvousApp
All Implemented Interfaces:
RendezvousStrategy<RendezvousSocketNodeHandle>

public class RendezvousApp
extends PastryAppl
implements RendezvousStrategy<RendezvousSocketNodeHandle>

TODO: make not abstract

Author:
Jeff Hoye

Field Summary
protected  LeafSet leafSet
           
protected  SelectorManager selectorManager
           
protected  RendezvousTransportLayer<RendezvousSocketNodeHandle> tl
           
 
Fields inherited from class rice.pastry.client.PastryAppl
address, deserializer, instance, logger, options, receiver, thePastryNode
 
Fields inherited from interface org.mpisws.p2p.transport.rendezvous.RendezvousStrategy
SUCCESS
 
Constructor Summary
RendezvousApp(PastryNode pn)
           
 
Method Summary
 boolean deliverWhenNotReady()
          Instructs the MessageDispatch how to behave when the PastryNode is not ready.
 void isNatted(NodeHandle bootstrap, Continuation<java.net.InetSocketAddress,java.lang.Exception> receiveResult)
          Can be called before you boot, will tell you if you are Firewalled.
 void messageForAppl(Message msg)
          If this is going to cause an infinite loop, just drop the message.
 Cancellable openChannel(RendezvousSocketNodeHandle target, RendezvousSocketNodeHandle rendezvous, RendezvousSocketNodeHandle source, int uid, Continuation<java.lang.Integer,java.lang.Exception> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
          Calls ChannelOpener.openChannel(dest, credentials) on target Possible exceptions to deliverResultToMe: NodeIsFaultyException if target is faulty UnableToConnectException if dest is faulty Called by: 1) Rendezvous if the target and source are NATted 2) Source if target is NATted, but source isn't Not called if the pilotFinder found a pilot for the target (in FreePastry this means that this will not be called if the target is in the leafSet).
 MessageRequestHandle<RendezvousSocketNodeHandle,java.nio.ByteBuffer> sendMessage(RendezvousSocketNodeHandle i, java.nio.ByteBuffer m, MessageCallback<RendezvousSocketNodeHandle,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> ops)
          Sends the message via an out-of-band channel.
 void setTransportLayer(RendezvousTransportLayer<RendezvousSocketNodeHandle> tl)
           
 java.lang.String toString()
           
 
Methods inherited from class rice.pastry.client.PastryAppl
accept, canReceiveSocket, connect, destroy, enrouteMessage, finishReceiveSocket, getAddress, getDeserializer, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, leafSetChange, notifyReady, receiveMessage, receiveMessageInternal, register, routeMsg, routeMsg, routeMsgDirect, routeSetChange, setDeserializer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

leafSet

protected LeafSet leafSet

selectorManager

protected SelectorManager selectorManager

tl

protected RendezvousTransportLayer<RendezvousSocketNodeHandle> tl
Constructor Detail

RendezvousApp

public RendezvousApp(PastryNode pn)
Method Detail

isNatted

public void isNatted(NodeHandle bootstrap,
                     Continuation<java.net.InetSocketAddress,java.lang.Exception> receiveResult)
Can be called before you boot, will tell you if you are Firewalled. Should send a message to the bootstrap, who forwards it to another node who sends you the request back. Should try UDP/TCP. Returns your external address.

Parameters:
bootstrap -
receiveResult -

messageForAppl

public void messageForAppl(Message msg)
If this is going to cause an infinite loop, just drop the message. The infinite loop is caused when the next hop is the destination of the message, and is NATted. ... and we're not connected?

Specified by:
messageForAppl in class PastryAppl
Parameters:
msg - the message that is arriving.

deliverWhenNotReady

public boolean deliverWhenNotReady()
Description copied from class: PastryAppl
Instructs the MessageDispatch how to behave when the PastryNode is not ready. An application can override this method to return true if it wishes to receive messages before Pastry is ready(). Most applications should leave this as false, so that their application does not have inconsistent routing. However Pastry's protocols (such as the join protocol) need to receive messages before pastry is ready(). This is because they are attempting to make pastry ready().

Overrides:
deliverWhenNotReady in class PastryAppl
Returns:
false unless the node is a service

openChannel

public Cancellable openChannel(RendezvousSocketNodeHandle target,
                               RendezvousSocketNodeHandle rendezvous,
                               RendezvousSocketNodeHandle source,
                               int uid,
                               Continuation<java.lang.Integer,java.lang.Exception> deliverAckToMe,
                               java.util.Map<java.lang.String,java.lang.Object> options)
Description copied from interface: RendezvousStrategy
Calls ChannelOpener.openChannel(dest, credentials) on target Possible exceptions to deliverResultToMe: NodeIsFaultyException if target is faulty UnableToConnectException if dest is faulty Called by: 1) Rendezvous if the target and source are NATted 2) Source if target is NATted, but source isn't Not called if the pilotFinder found a pilot for the target (in FreePastry this means that this will not be called if the target is in the leafSet).

Specified by:
openChannel in interface RendezvousStrategy<RendezvousSocketNodeHandle>
Parameters:
target - call ChannelOpener.openChannel() on this Identifier
rendezvous - pass this to ChannelOpener.openChannel(), it's who the ChannelOpener will connect to
deliverAckToMe - notify me when success/failure
Returns:
a way to cancel the request

sendMessage

public MessageRequestHandle<RendezvousSocketNodeHandle,java.nio.ByteBuffer> sendMessage(RendezvousSocketNodeHandle i,
                                                                                        java.nio.ByteBuffer m,
                                                                                        MessageCallback<RendezvousSocketNodeHandle,java.nio.ByteBuffer> deliverAckToMe,
                                                                                        java.util.Map<java.lang.String,java.lang.Object> ops)
Description copied from interface: RendezvousStrategy
Sends the message via an out-of-band channel. Usually routing.

Specified by:
sendMessage in interface RendezvousStrategy<RendezvousSocketNodeHandle>
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setTransportLayer

public void setTransportLayer(RendezvousTransportLayer<RendezvousSocketNodeHandle> tl)
Specified by:
setTransportLayer in interface RendezvousStrategy<RendezvousSocketNodeHandle>

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection