public class SimpleRouter extends Object
UpdateForwardingStockQuotes. The router is unaware of the state (
Replica) of each node and simply forwards requests entered at the router's console to each node in the group in Round Robin fashion.
UpdateForwardingStockQuotes instance will in turn, if
necessary, forward any write requests to the current master and return the
results back to SimpleRouter.
instances do not have their own consoles, they only service requests
delivered over the network by this router.
host:port pairs as arguments, one pair for
each instance of the
The port numbers in this case are application, not HA, port numbers on which
UpdateForwardingStockQuotes application listens for
application messages forwarded by
SimpleRouter. They must
therefore be different from the ports used internally by HA, that is, from
the HA port numbers specified as arguments to
UpdateForwardingStockQuotes. The application port number is
computed in this example by adding
HARouter.APP_PORT_DISPLACEMENT (default value 100) to the HA
port number associated with the node. So, if node "n1" uses port 5001 for
HA, it must (based upon the conventions used in these examples) use port
5101, for application level communication.
SimpleRouter can thus be invoked as follows:
java je.rep.quote.SimpleRouter node.acme.com:5101 node.acme.com:5102 node.acme.com:5103for a three node group. In this case, the applications will use ports 5101, through 5103 for application messages, while HA will use ports 5001 through 5003.
SimpleRouter and UpdateForwardingStockQuotes can be started in any order.
Copyright (c) 2002, 2015 Oracle and/or its affiliates. All rights reserved.