Class RmiRequestDispatcher

java.lang.Object
org.rribbit.dispatching.RmiRequestDispatcher
All Implemented Interfaces:
RequestDispatcher

public class RmiRequestDispatcher extends Object implements RequestDispatcher
This RequestDispatcher dispatches a Request to an RmiRequestProcessor via RMI. It offers automatic loadbalancing and failover.

Note that the RMI connection is NOT maintained between requests, meaning that a new connection is set up each time a request is made to this RmiRequestDispatcher. This also means that, if you choose to use SSL, an SSL handshake is done on each request.

Author:
G.J. Schouten
  • Field Details

    • retryAttempts

      protected int retryAttempts
    • portnumber

      protected int portnumber
    • hosts

      protected String[] hosts
    • truststoreLocation

      protected String truststoreLocation
  • Constructor Details

    • RmiRequestDispatcher

      public RmiRequestDispatcher(int portnumber, String... hosts)
      Connects to RmiRequestProcessors that run on the specified port and on the specified hosts. If multiple hosts are specified, one is randomly chosen at runtime, creating automatic load-balancing. If a connection to a host fails, another one is chosen. The default number of retries is 10 and can be set with the corresponding setter.

      Use this constructor if you do NOT want to use SSL.

      Parameters:
      portnumber - The portnumber to use
      hosts - The hosts to connect to, you can specify one host multiple times, to give it a proportionally larger chance of being chosen
    • RmiRequestDispatcher

      public RmiRequestDispatcher(String truststoreLocation, int portnumber, String... hosts)
      Connects to RmiRequestProcessors that run on the specified port and on the specified hosts. If multiple hosts are specified, one is randomly chosen at runtime, creating automatic load-balancing. If a connection to a host fails, another one is chosen. The default number of retries is 10 and can be set with the corresponding setters.

      Use this constructor if you DO want to use SSL. The "javax.net.ssl.trustStore" system property will be set.

      Parameters:
      truststoreLocation - The filepath that contains the SSL truststore, without file://
      portnumber - The portnumber to use
      hosts - The hosts to connect to, you can specify one host multiple times, to give it a proportionally larger chance of being chosen
  • Method Details