private AnycastAddress getDestinations(List<Address> members) { int rand = members.indexOf(jChannel.getAddress()); AnycastAddress address = new AnycastAddress(); address.add(members.get(rand++ % members.size()), members.get(rand++ % members.size()), members.get(rand % members.size())); return address; }
public AnycastAddress(Collection<Address> addresses) { addAll(addresses); }
private Collection<Address> extract(AnycastAddress anycastAddress) { return anycastAddress.findAddresses().orElseGet(deliverManager::getViewMembers); }
public void add(Address... addresses) { if (addresses.length == 0) { return; } initCollection(addresses.length); for (Address address : addresses) { internalAdd(address); } }
public void addAll(Collection<Address> addresses) { if (addresses == null || addresses.isEmpty()) { return; } initCollection(addresses.size()); addresses.forEach(this::internalAdd); }
public AnycastAddress(Address... addresses) { add(addresses); }
public int compareTo(Address o) { int hc1, hc2; if (this == o) return 0; if (!(o instanceof AnycastAddress)) throw new ClassCastException("comparison between different classes: the other object is " + (o != null ? o.getClass() : o)); AnycastAddress other = (AnycastAddress) o; hc1 = this.hashCode(); hc2 = other.hashCode(); if (hc1 == hc2) { int size = destinations == null ? 0 : destinations.size(); int otherSize = other.destinations == null ? 0 : other.destinations.size(); //it is always positive and they should be small. safe to do this: return size - otherSize; } else { return hc1 < hc2 ? -1 : 1; } }
transport.down(msg.dest(new AnycastAddress(dest_mbrs)));
public void add(Address... addresses) { if (addresses.length == 0) { return; } initCollection(addresses.length); for (Address address : addresses) { internalAdd(address); } }
public void addAll(Collection<Address> addresses) { if (addresses == null || addresses.isEmpty()) { return; } initCollection(addresses.size()); addresses.forEach(this::internalAdd); }
public AnycastAddress(Address... addresses) { add(addresses); }
public int compareTo(Address o) { int hc1, hc2; if (this == o) return 0; if (!(o instanceof AnycastAddress)) throw new ClassCastException("comparison between different classes: the other object is " + (o != null ? o.getClass() : o)); AnycastAddress other = (AnycastAddress) o; hc1 = this.hashCode(); hc2 = other.hashCode(); if (hc1 == hc2) { int size = destinations == null ? 0 : destinations.size(); int otherSize = other.destinations == null ? 0 : other.destinations.size(); //it is always positive and they should be small. safe to do this: return size - otherSize; } else { return hc1 < hc2 ? -1 : 1; } }
transport.down(msg.dest(new AnycastAddress(dest_mbrs)));
private AnycastAddress getDestinations(List<Address> members) { int rand = members.indexOf(jChannel.getAddress()); AnycastAddress address = new AnycastAddress(); address.add(members.get(rand++ % members.size()), members.get(rand++ % members.size()), members.get(rand % members.size())); return address; }
private Collection<Address> extract(AnycastAddress anycastAddress) { return anycastAddress.findAddresses().orElseGet(deliverManager::getViewMembers); }
public AnycastAddress(Collection<Address> addresses) { addAll(addresses); }