/** * Send a specific message to the supplied role. * * @param destination Destination role * @param msg Message to send */ public void send(PaxosRole destination, PaxosMessage msg) { StaticNetwork.Route route = network.getRoute(destination.getID()); if (route != null) { msg.setDestination(destination.getType()); pipeline.startClient(route.ip, route.port, msg); } }
/** * Start listening for network communication. * * @param id ID identifying the listening node. */ public void startListening(String id) { home = id; StaticNetwork.Route route = network.getRoute(id); if (route != null) { if (pipeline.startServer(route.port)) { logger.log(Level.INFO, String.format("%s: listening port %d", id, route.port)); } } }