/** * Returns true if the provide member belongs to this membership using * unique ID information as well as the basic checks */ public boolean containsExt(Address member) { if (member == null || !(member instanceof IpAddress)) return false; IpAddress pmbr = (IpAddress)member; synchronized(members) { for (Iterator<IpAddress> it = members.iterator(); it.hasNext(); ) { IpAddress each = it.next(); if (each.equals(pmbr) && each.getBirthViewId() == pmbr.getBirthViewId()) { return true; } } } return false; }
/** GemStoneAddition - return the weight of the given IDs */ public static int getWeight(Collection ids, Address leader) { int weight = 0; for (Iterator<IpAddress> it=ids.iterator(); it.hasNext(); ) { IpAddress addr = it.next(); int thisWeight = addr.getMemberWeight(); if (addr.getVmKind() == 10 /* NORMAL_DM_KIND */) { thisWeight += 10; if (leader != null && addr.equals(leader)) { thisWeight += 5; } } else if (addr.preferredForCoordinator()) { thisWeight += 3; } weight += thisWeight; } return weight; }
public void testAddressEquality() throws Exception { IpAddress addr1 = new IpAddress(InetAddress.getLocalHost(), 1234); IpAddress addr2 = new IpAddress(addr1.getIpAddress(), addr1.getPort()); if (!addr1.equals(addr2)) { fail("expected addresses to be equal"); } addr2.setBirthViewId(4); if (!addr1.equals(addr2)) { fail("expected addresses to be equal"); } addr1.setBirthViewId(0); int comparison = addr1.compareTo(addr2); if (comparison >= 0) { fail("expected addresses to be unequal but compareTo returned " + comparison); } }
if (dest.equals(this.local_addr)) { synchronized(prepare_collector) { prepare_collector.ack(dest, null);
for (Iterator it=members.getMembers().iterator(); it.hasNext(); ) { IpAddress addr = (IpAddress)it.next(); if (addr.equals(hdr.mbr)) { if (addr.getUniqueID() != hmbr.getUniqueID()) { log.getLogWriter().info(