org.jgroups.protocols.relay.SiteMaster Maven / Gradle / Ivy
Go to download
This artifact provides a single jar that contains all classes required to use remote Jakarta Enterprise Beans and Jakarta Messaging, including
all dependencies. It is intended for use by those not using maven, maven users should just import the Jakarta Enterprise Beans and
Jakarta Messaging 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 org.jgroups.util.UUID;
import org.jgroups.util.Util;
import java.util.Arrays;
/**
* Special address with the UUID part being 0: identifies the current (relay) coordinator of a given site. E,g, if we
* send a message with dest=SiteMaster(SFO) from site LON, then the message will be forwarded to the relay coordinator
* of the SFO site
* @author Bela Ban
* @since 3.2
*/
public class SiteMaster extends SiteUUID {
private static final long serialVersionUID=-6147979304449032483L;
public SiteMaster() {
setFlag(site_master);
}
public SiteMaster(String site) {
this(Util.stringToBytes(site));
}
public SiteMaster(byte[] site) {
super(0, 0, null, site);
setFlag(site_master);
}
public int compareTo(Address other) {
if(other instanceof SiteMaster) {
SiteMaster tmp=(SiteMaster)other;
return Util.compare(get(SITE_NAME), tmp.get(SITE_NAME));
}
return super.compareTo(other);
}
public boolean equals(Object obj) {
return compareTo((Address)obj) == 0;
}
public int hashCode() {
return Arrays.hashCode(get(SITE_NAME));
}
public UUID copy() {
return new SiteMaster(get(SITE_NAME));
}
public String toString() {
return "SiteMaster(" + getSite() + ")";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy