|
Project JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.endpoint.router.EndpointRouter
public class EndpointRouter
Nested Class Summary | |
---|---|
protected class |
EndpointRouter.ClearPendingQuery
|
Field Summary | |
---|---|
static long |
ASYNC_MESSENGER_WAIT
how long we are willing to wait for a response from an async getMessenger. |
(package private) EndpointService |
endpoint
endpointservice handle |
static Integer |
GET_ROUTE_CONTROL
MessageTransport Control operation |
protected EndpointAddress |
localPeerAddr
local peer ID as a endpointAddress. |
protected Map |
pendingQueries
We record queries when first started and keep them pending for a while. |
static int |
RouteControlOp
|
static String |
routerSName
Router Service Name |
Fields inherited from interface net.jxta.platform.Module |
---|
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_OK |
Constructor Summary | |
---|---|
EndpointRouter()
Default constructor |
Method Summary | |
---|---|
protected static PeerID |
addr2pid(EndpointAddress addr)
convert an endpointRouterAddress into a PeerID |
(package private) EndpointAddress |
addressMessage(Message message,
EndpointAddress dstAddress)
Updates the router element of a message and returns the pid address of the next hop (where to send the message). |
boolean |
allowsRouting()
|
protected List |
cleanupAnyEdges(String src,
List results)
cleanup any edge peers when trying to forward an SRDI query so we are guaranteed to the best of our knowledge that the peer is a rendezvous. |
protected Messenger |
ensureLocalRoute(EndpointAddress pId,
Object hint)
Ensure there is a local route for a given peer id if it can at all be done. |
(package private) Messenger |
findBestReachableEndpoint(EndpointAddress dest,
List mightWork,
boolean exist)
Given a list of addresses, find the best reachable endpoint. |
(package private) Messenger |
findReachableEndpoint(EndpointAddress destPeer,
boolean exist)
Read the route advertisement for a peer and find a suitable transport endpoint for sending to that peere either directly or via one of the advertised peer router |
(package private) Messenger |
findReachableEndpoint(EndpointAddress destPeer,
boolean exist,
Object hint)
|
protected Iterator |
getAllCachedMessengerDestinations()
Get all direct route destinations |
protected Iterator |
getAllRoutedRouteAddresses()
Get all long route destination addresses |
protected BadRoute |
getBadRoute(EndpointAddress addr)
get bad route entry |
protected Messenger |
getCachedMessenger(EndpointAddress addr)
Snoop if we have a messenger |
EndpointService |
getEndpointService()
|
(package private) EndpointAddress |
getGatewayAddress(EndpointAddress dest,
boolean seekRoute)
Given a peer id, return an address to reach that peer. |
(package private) EndpointAddress |
getGatewayAddress(EndpointAddress dest,
boolean seekRoute,
Object hint)
|
Messenger |
getMessenger(EndpointAddress addr,
Object hint)
|
protected RouteAdvertisement |
getMyLocalRoute()
|
protected Iterator |
getPendingQueriesAllDestinations()
Get all pendingRouteQuery destinations |
protected EndpointRouter.ClearPendingQuery |
getPendingRouteQuery(EndpointAddress addr)
get a pending route query info |
String |
getProtocolName()
|
EndpointAddress |
getPublicAddress()
|
Iterator |
getPublicAddresses()
|
protected RouteAdvertisement |
getRoute(EndpointAddress pId,
boolean seekRoute)
Get the routed route, if any, for a given peer id. |
protected RouteCM |
getRouteCM()
Get the route CM cache Manager |
protected Iterator |
getRoutedRouteAllDestinations()
Get all long route destinations |
protected RouteResolver |
getRouteResolver()
Get the route resolver manager |
void |
init(PeerGroup g,
ID assignedID,
Advertisement impl)
|
boolean |
isConnectionOriented()
|
protected boolean |
isLocalRoute(EndpointAddress pId)
isLocalRoute is a shalow test. |
protected boolean |
isPendingRouteQuery(EndpointAddress addr)
is there a pending route query for that destination |
boolean |
isPropagateEnabled()
(@inheritdoc} |
boolean |
isPropagationSupported()
(@inheritdoc} |
protected boolean |
isRoutedRoute(EndpointAddress addr)
Do we have a longue route for that destination |
boolean |
messengerReady(MessengerEvent event)
Receives notifications of new messengers being generated by the underlying network transports. |
boolean |
newMessenger(MessengerEvent event)
call when an asynchronous new messenger is ready. |
void |
noMessenger(EndpointAddress logDest)
call when an asynchronous new messenger could not be obtained. |
protected static EndpointAddress |
pid2addr(PeerID pid)
convert a PeerID into an EndpointRouter Address |
boolean |
ping(EndpointAddress addr)
Returns true if the target address is reachable. |
void |
processIncomingMessage(Message msg,
EndpointAddress srcAddr,
EndpointAddress dstAddr)
|
void |
propagate(Message srcMsg,
String pName,
String pParam,
String prunePeer)
|
protected void |
removeRoute(EndpointAddress pId)
This method is used to remove a route |
(package private) void |
sendOnLocalRoute(EndpointAddress destination,
Message message)
Send a message to a given logical destination if it maps to some messenger in our messenger pool or if such a mapping can be found and added. |
protected void |
setBadRoute(EndpointAddress addr,
BadRoute badRoute)
set bad route entry |
protected boolean |
setRoute(RouteAdvertisement r,
boolean force)
set new route info |
int |
startApp(String[] arg)
|
void |
stopApp()
Careful that stopApp() could in theory be called before startApp(). |
Object |
transportControl(Object operation,
Object value)
|
protected void |
updateRouteAdv(RouteAdvertisement route)
check if it is a new route adv |
protected void |
updateRouteAdv(RouteAdvertisement route,
boolean force)
check if it is a new route adv |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected EndpointAddress localPeerAddr
EndpointService endpoint
public static final String routerSName
protected Map pendingQueries
EndpointAddress
.EndpointRouter.ClearPendingQuery
.
public static final Integer GET_ROUTE_CONTROL
public static final int RouteControlOp
public static final long ASYNC_MESSENGER_WAIT
Constructor Detail |
---|
public EndpointRouter()
Method Detail |
---|
protected RouteAdvertisement getMyLocalRoute()
protected boolean isLocalRoute(EndpointAddress pId)
protected Messenger ensureLocalRoute(EndpointAddress pId, Object hint)
pId
- the peer who's route is desired.hint
- specify a specific route hint to use
void sendOnLocalRoute(EndpointAddress destination, Message message) throws IOException
destination
- peer-based address to send the message to.message
- the message to be sent.
IOException
public void init(PeerGroup g, ID assignedID, Advertisement impl) throws PeerGroupException
init
in interface Module
PeerGroupException
public int startApp(String[] arg)
startApp
in interface Module
public void stopApp()
stopApp
in interface Module
public boolean isConnectionOriented()
isConnectionOriented
in interface MessageSender
public boolean allowsRouting()
allowsRouting
in interface MessageSender
public EndpointService getEndpointService()
getEndpointService
in interface MessageTransport
public EndpointAddress getPublicAddress()
getPublicAddress
in interface MessageSender
public Iterator getPublicAddresses()
getPublicAddresses
in interface MessageReceiver
public String getProtocolName()
getProtocolName
in interface MessageTransport
public boolean isPropagateEnabled()
isPropagateEnabled
in interface MessageSender
public boolean isPropagationSupported()
isPropagationSupported
in interface MessageSender
public void propagate(Message srcMsg, String pName, String pParam, String prunePeer) throws IOException
propagate
in interface MessageSender
IOException
EndpointAddress getGatewayAddress(EndpointAddress dest, boolean seekRoute)
dest
- the peer we are trying to reach.seekRoute
- whether to go as far as issuing a route query, or just fish in our cache.
when forwarding a message we allow ourselves to mend a broken source-issued route but we
won't go as far as seeking one from other peers. When originating a message, on the other end
we will aggressively try to find route.hint
- whether we are passed a route hint to be used, in that case that route
hint should be used
EndpointAddress getGatewayAddress(EndpointAddress dest, boolean seekRoute, Object hint)
public boolean ping(EndpointAddress addr)
ping
in interface MessageSender
public boolean messengerReady(MessengerEvent event)
messengerReady
in interface MessengerEventListener
event
- the new messenger event.public void noMessenger(EndpointAddress logDest)
logDest
- the failed logical destinationpublic boolean newMessenger(MessengerEvent event)
event
- the new messenger event.protected RouteAdvertisement getRoute(EndpointAddress pId, boolean seekRoute)
pId
- the peer who's route is desired.seekRoute
- boolean to indicate if we should search for a route
if we don't have one
protected boolean setRoute(RouteAdvertisement r, boolean force)
r
- new route to learnforce
- true if the route was optained by receiving
a messageprotected void removeRoute(EndpointAddress pId)
pId
- route to peerid to be removedpublic void processIncomingMessage(Message msg, EndpointAddress srcAddr, EndpointAddress dstAddr)
processIncomingMessage
in interface EndpointListener
Messenger findBestReachableEndpoint(EndpointAddress dest, List mightWork, boolean exist)
addrs
- A list of addresses to evaulate reachability.exist
- true if there already are existing messengers for
the given destinations but we want one more. It may lead us to reject
certain addresses that we would otherwise accept.
Messenger findReachableEndpoint(EndpointAddress destPeer, boolean exist)
Messenger findReachableEndpoint(EndpointAddress destPeer, boolean exist, Object hint)
public Messenger getMessenger(EndpointAddress addr, Object hint)
getMessenger
in interface MessageSender
EndpointAddress addressMessage(Message message, EndpointAddress dstAddress)
message
- the message for which to compute/update a route.destAddress
- the final destination of the route which the message be set to follow.
public Object transportControl(Object operation, Object value)
transportControl
in interface MessageTransport
protected static PeerID addr2pid(EndpointAddress addr)
protected static EndpointAddress pid2addr(PeerID pid)
protected void updateRouteAdv(RouteAdvertisement route)
protected void updateRouteAdv(RouteAdvertisement route, boolean force)
protected List cleanupAnyEdges(String src, List results)
protected boolean isPendingRouteQuery(EndpointAddress addr)
addr
- destination address
protected EndpointRouter.ClearPendingQuery getPendingRouteQuery(EndpointAddress addr)
addr
- destination address
protected boolean isRoutedRoute(EndpointAddress addr)
addr
- destination address
protected Messenger getCachedMessenger(EndpointAddress addr)
addr
- destination address
protected Iterator getAllCachedMessengerDestinations()
protected Iterator getRoutedRouteAllDestinations()
protected Iterator getAllRoutedRouteAddresses()
protected Iterator getPendingQueriesAllDestinations()
protected RouteCM getRouteCM()
protected RouteResolver getRouteResolver()
protected void setBadRoute(EndpointAddress addr, BadRoute badRoute)
addr
- of the bad routebadRoute
- bad route infoprotected BadRoute getBadRoute(EndpointAddress addr)
addr
- of the bad route
|
JXTA J2SE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |