Search in sources :

Example 1 with SiteUUID

use of org.jgroups.protocols.relay.SiteUUID in project JGroups by belaban.

the class SizeTest method testRelay2Header.

public static void testRelay2Header() throws Exception {
    Address dest = new SiteMaster("sfo");
    RELAY2.Relay2Header hdr = new RELAY2.Relay2Header(RELAY2.Relay2Header.DATA, dest, null);
    _testSize(hdr);
    Address sender = new SiteUUID(UUID.randomUUID(), "dummy", "sfo");
    hdr = new RELAY2.Relay2Header(RELAY2.Relay2Header.DATA, dest, sender);
    _testSize(hdr);
}
Also used : IpAddress(org.jgroups.stack.IpAddress) SiteMaster(org.jgroups.protocols.relay.SiteMaster) SiteUUID(org.jgroups.protocols.relay.SiteUUID) RELAY2(org.jgroups.protocols.relay.RELAY2)

Example 2 with SiteUUID

use of org.jgroups.protocols.relay.SiteUUID in project JGroups by belaban.

the class ExtendedUUIDTest method testSiteUUID.

public void testSiteUUID() throws Exception {
    UUID a = (UUID) Util.createRandomAddress("A"), b = (UUID) Util.createRandomAddress("B");
    SiteUUID sa = new SiteUUID(a, "sm-a", "sfo");
    SiteUUID sb = new SiteUUID(b, "b", "lon").put(Util.stringToBytes("id"), Util.objectToByteBuffer(322649)).setFlag(RELAY2.can_become_site_master_flag);
    System.out.println("sb = " + sb);
    assert sa.getName().equals("sm-a");
    assert sa.getSite().equals("sfo");
    SiteUUID copy = (SiteUUID) sb.copy();
    assert copy.equals(sb);
    assert copy.getName().equals(sb.getName());
    assert copy.getSite().equals(sb.getSite());
}
Also used : SiteUUID(org.jgroups.protocols.relay.SiteUUID) SiteUUID(org.jgroups.protocols.relay.SiteUUID) UUID(org.jgroups.util.UUID) ExtendedUUID(org.jgroups.util.ExtendedUUID) FlagsUUID(org.jgroups.util.FlagsUUID)

Example 3 with SiteUUID

use of org.jgroups.protocols.relay.SiteUUID in project JGroups by belaban.

the class Util method readAddress.

public static Address readAddress(DataInput in) throws Exception {
    byte flags = in.readByte();
    if (Util.isFlagSet(flags, Address.NULL))
        return null;
    Address addr;
    if (Util.isFlagSet(flags, Address.UUID_ADDR)) {
        addr = new UUID();
        addr.readFrom(in);
    } else if (Util.isFlagSet(flags, Address.SITE_UUID)) {
        addr = new SiteUUID();
        addr.readFrom(in);
    } else if (Util.isFlagSet(flags, Address.SITE_MASTER)) {
        addr = new SiteMaster();
        addr.readFrom(in);
    } else if (Util.isFlagSet(flags, Address.IP_ADDR)) {
        addr = new IpAddress();
        addr.readFrom(in);
    } else if (Util.isFlagSet(flags, Address.IP_ADDR_UUID)) {
        addr = new IpAddressUUID();
        addr.readFrom(in);
    } else {
        addr = readOtherAddress(in);
    }
    return addr;
}
Also used : IpAddress(org.jgroups.stack.IpAddress) SiteMaster(org.jgroups.protocols.relay.SiteMaster) IpAddress(org.jgroups.stack.IpAddress) SiteUUID(org.jgroups.protocols.relay.SiteUUID) SiteUUID(org.jgroups.protocols.relay.SiteUUID) IpAddressUUID(org.jgroups.stack.IpAddressUUID) IpAddressUUID(org.jgroups.stack.IpAddressUUID)

Aggregations

SiteUUID (org.jgroups.protocols.relay.SiteUUID)3 SiteMaster (org.jgroups.protocols.relay.SiteMaster)2 IpAddress (org.jgroups.stack.IpAddress)2 RELAY2 (org.jgroups.protocols.relay.RELAY2)1 IpAddressUUID (org.jgroups.stack.IpAddressUUID)1 ExtendedUUID (org.jgroups.util.ExtendedUUID)1 FlagsUUID (org.jgroups.util.FlagsUUID)1 UUID (org.jgroups.util.UUID)1