Class StickySiteMasterPicker

  • All Implemented Interfaces:
    SiteMasterPicker

    public class StickySiteMasterPicker
    extends RandomSiteMasterPicker
    Picks a local site master or a route based on the sender and caches the decision. Next time, the same local site master or route will be returned. If no route exists yet, a random local site master or route is picked.
    Since:
    5.3.1
    Author:
    Bela Ban
    • Field Detail

      • local_sm_cache

        protected java.util.Map<Address,​Address> local_sm_cache
      • route_cache

        protected java.util.Map<Address,​Route> route_cache
    • Constructor Detail

      • StickySiteMasterPicker

        public StickySiteMasterPicker()
    • Method Detail

      • pickSiteMaster

        public Address pickSiteMaster​(java.util.List<Address> site_masters,
                                      Address original_sender)
        Description copied from interface: SiteMasterPicker
        Needs to pick a member from a list of addresses of site masters
        Specified by:
        pickSiteMaster in interface SiteMasterPicker
        Overrides:
        pickSiteMaster in class RandomSiteMasterPicker
        Parameters:
        site_masters - The list of site masters
        original_sender - The address of the original member sending a message
        Returns:
        The address of the site master (in the local cluster) to be used to forward the message to
      • pickRoute

        public Route pickRoute​(java.lang.String site,
                               java.util.List<Route> routes,
                               Address original_sender)
        Description copied from interface: SiteMasterPicker
        Picks a route to a given remote site from a list of routes.
        Specified by:
        pickRoute in interface SiteMasterPicker
        Overrides:
        pickRoute in class RandomSiteMasterPicker
        Parameters:
        site - The name of the target (remote) site. Added for informational purposes; may or may not be used as selection criterium.
        routes - The list of routes. A route can be picked for example by using the address of the remote site master: Route.siteMaster()
        original_sender - The address of the original sender
        Returns:
        A route