@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Add, seed); } },
@Override public ChangeNotification<T> call(T data) { return new ChangeNotification<>(Kind.Add, data); } };
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Add, seed); } },
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Delete, seed); } },
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Add, seed); } },
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Delete, seed); } },
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Add, seed); } },
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Delete, seed); } },
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Delete, seed); } },
public StaticServerResolver(LoadBalancerBuilder<Server> loadBalancerBuilder, Server... serverList) { super(loadBalancerBuilder); List<ChangeNotification<Server>> updates = new ArrayList<>(serverList.length); for (Server server : serverList) { updates.add(new ChangeNotification<Server>(Kind.Add, server)); } updateStream = Observable.from(updates); }
private Set<ChangeNotification<Server>> cancellationSet(Set<ChangeNotification<Server>> currentSnapshot, Set<ChangeNotification<Server>> newAddresses) { Set<ChangeNotification<Server>> cancelled = new HashSet<>(); for (ChangeNotification<Server> entry : currentSnapshot) { if (!newAddresses.contains(entry)) { cancelled.add(new ChangeNotification<Server>(Kind.Delete, entry.getData())); } } return cancelled; }
public static <T> Observable<ChangeNotification<T>> from(T... values) { if (values == null || values.length == 0) { return Observable.empty(); } List<ChangeNotification<T>> notifications = new ArrayList<>(values.length); for (T value : values) { notifications.add(new ChangeNotification<T>(Kind.Add, value)); } return Observable.from(notifications); }
private Set<ChangeNotification<String>> cancellationSet(Set<ChangeNotification<String>> currentSnapshot, Set<ChangeNotification<String>> newAddresses) { Set<ChangeNotification<String>> cancelled = new HashSet<>(); for (ChangeNotification<String> entry : currentSnapshot) { if (!newAddresses.contains(entry)) { cancelled.add(new ChangeNotification<String>(Kind.Delete, entry.getData())); } } return cancelled; } }
public StaticEurekaClusterResolver(List<ClusterAddress> clusterAddresses) { List<ChangeNotification<ClusterAddress>> addNotifications = new ArrayList<>(clusterAddresses.size()); for (ClusterAddress address : clusterAddresses) { addNotifications.add(new ChangeNotification<ClusterAddress>(Kind.Add, address)); } addNotifications.add(ChangeNotification.<ClusterAddress>bufferSentinel()); this.clusterObserver = Observable.from(addNotifications); }
private static Observable<ChangeNotification<InetSocketAddress>> fromList(ServerBootstrap[] bootstraps) { List<ChangeNotification<InetSocketAddress>> addresses = new ArrayList<>(bootstraps.length); for (ServerBootstrap sb : bootstraps) { addresses.add(new ChangeNotification<>( Kind.Add, new InetSocketAddress(sb.getHostname(), sb.getReplicationPort())) ); } return Observable.from(addresses); } }
public DnsChangeNotificationSource(String domainName, long reloadInterval, long idleTimeout, TimeUnit reloadUnit, Scheduler scheduler) { this.domainName = domainName; if ("localhost".equals(domainName)) { this.resolverObservable = Observable.just(new ChangeNotification<>(Kind.Add, domainName)); } else { this.resolverObservable = ResourceObservable.fromResource(new DnsResolverTask(), reloadInterval, idleTimeout, reloadUnit, scheduler); } }
private void removeServerAddress(int idx) { ChangeNotification<A> addChange = clusterAddresses.remove(idx); clusterAddressUpdates.onNext(new ChangeNotification<A>(Kind.Delete, addChange.getData())); } }
private void removeServerAddress(int idx) { ChangeNotification<A> addChange = clusterAddresses.remove(idx); clusterAddressUpdates.onNext(new ChangeNotification<A>(Kind.Delete, addChange.getData())); } }
public static ChangeNotification<InstanceInfo> addTimeStamp(ChangeNotification<InstanceInfo> notification, long timeStamp) { InstanceInfo timeStamped = addTimeStamp(notification.getData(), timeStamp); switch (notification.getKind()) { case Add: case Delete: return new ChangeNotification<>(notification.getKind(), timeStamped); case Modify: return new ModifyNotification<>(timeStamped, ((ModifyNotification) notification).getDelta()); default: throw new IllegalArgumentException("Unexpected enum value " + notification.getKind()); } }
@Override public ChangeNotification<Server> call(ChangeNotification<ClusterAddress> notification) { if (notification.getKind() == Kind.BufferSentinel) { return ChangeNotification.bufferSentinel(); } Server server = new Server( notification.getData().getHostName(), notification.getData().getPortFor(serviceType) ); return new ChangeNotification<Server>(notification.getKind(), server); } });