org.jgroups.protocols.relay.SiteMasterPicker Maven / Gradle / Ivy
Go to download
This artifact provides a single jar that contains all classes required to use remote EJB and JMS, including
all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and
JMS BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up
with different versions on classes on the class path).
package org.jgroups.protocols.relay;
import org.jgroups.Address;
import java.util.List;
/**
* Allows an implementation to pick a {@link SiteMaster} or a {@link Route} from a list (if multiple site masters are
* enabled). An implementation could for example always pick the same site master (or route) for messages from a given
* sender (sticky site master policy, see https://issues.redhat.com/browse/JGRP-2112).
* The default implementation picks a random site master for every message to be relayed, even if they have the same
* original sender.
* If only one site master is configured, then {@link #pickSiteMaster(List,Address)} (List,Address)} or
* {@link #pickRoute(String,List,Address)} will never be called.
* @author Bela Ban
* @since 3.6.12, 4.0
*/
public interface SiteMasterPicker {
/**
* Needs to pick a member from a list of addresses of site masters
* @param site_masters The list of site masters
* @param original_sender The address of the original member sending a message
* @return The address of the site master (in the local cluster) to be used to forward the message to
*/
Address pickSiteMaster(List site_masters, Address original_sender);
/**
* Picks a route to a given remote site from a list of routes.
* @param site The name of the target (remote) site. Added for informational purposes; may or may not be used
* as selection criterium.
* @param routes The list of routes. A route can be picked for example by using the address of the remote site
* master: {@link Route#siteMaster()}
* @param original_sender The address of the original sender
* @return A route
*/
Route pickRoute(String site, List routes, Address original_sender);
}