/** * Returns the route to a given site * @param site_name The site name, e.g. "SFO" * @return The route to the given site, or null if no route was found or we're not the coordinator */ public Route getRoute(String site_name) { Relayer tmp=relayer; return tmp != null? tmp.getRoute(site_name): null; }
protected Route getRoute(String site) { return getRoute(site, null);}
/** * Returns the bridge channel to a given site * @param site_name The site name, e.g. "SFO" * @return The JChannel to the given site, or null if no route was found or we're not the coordinator */ public JChannel getBridge(String site_name) { Relayer tmp=relayer; Route route=tmp != null? tmp.getRoute(site_name): null; return route != null? route.bridge() : null; }
/** * Routes the message to the target destination, used by a site master (coordinator) * @param dest * @param sender the address of the sender * @param msg The message */ protected void route(SiteAddress dest, SiteAddress sender, Message msg) { String target_site=dest.getSite(); if(target_site.equals(site)) { if(local_addr.equals(dest) || ((dest instanceof SiteMaster) && is_site_master)) { deliver(dest, sender, msg); } else deliverLocally(dest, sender, msg); // send to member in same local site return; } Relayer tmp=relayer; if(tmp == null) { log.warn(local_addr + ": not site master; dropping message"); return; } Route route=tmp.getRoute(target_site, sender); if(route == null) { log.error(local_addr + ": no route to " + target_site + ": dropping message"); sendSiteUnreachableTo(sender, target_site); } else route.send(dest,sender,msg); }
/** * Returns the route to a given site * @param site_name The site name, e.g. "SFO" * @return The route to the given site, or null if no route was found or we're not the coordinator */ public Route getRoute(String site_name) { Relayer tmp=relayer; return tmp != null? tmp.getRoute(site_name): null; }
protected Route getRoute(String site) { return getRoute(site, null);}
/** * Returns the bridge channel to a given site * @param site_name The site name, e.g. "SFO" * @return The JChannel to the given site, or null if no route was found or we're not the coordinator */ public JChannel getBridge(String site_name) { Relayer tmp=relayer; Route route=tmp != null? tmp.getRoute(site_name): null; return route != null? route.bridge() : null; }
/** * Routes the message to the target destination, used by a site master (coordinator) * @param dest * @param sender the address of the sender * @param msg The message */ protected void route(SiteAddress dest, SiteAddress sender, Message msg) { String target_site=dest.getSite(); if(target_site.equals(site)) { if(local_addr.equals(dest) || ((dest instanceof SiteMaster) && is_site_master)) { deliver(dest, sender, msg); } else deliverLocally(dest, sender, msg); // send to member in same local site return; } Relayer tmp=relayer; if(tmp == null) { log.warn(local_addr + ": not site master; dropping message"); return; } Route route=tmp.getRoute(target_site, sender); if(route == null) { log.error(local_addr + ": no route to " + target_site + ": dropping message"); sendSiteUnreachableTo(sender, target_site); } else route.send(dest,sender,msg); }