@Test public void addressIsAddedTwice() { assertThat(lb.activeAddresses(), is(empty())); sendServiceDiscoveryEvents(upEvent("address-1")); assertThat(lb.activeAddresses(), hasSize(1)); sendServiceDiscoveryEvents(upEvent("address-1")); assertThat(lb.activeAddresses(), hasSize(2)); sendServiceDiscoveryEvents(downEvent("address-1")); assertThat(lb.activeAddresses(), hasSize(1)); sendServiceDiscoveryEvents(downEvent("address-1")); assertThat(lb.activeAddresses(), hasSize(0)); }
List<Entry<ResolvedAddress, List<C>>> activeAddresses() { return activeHosts.stream().map(Host::asEntry).collect(toList()); }
RoundRobinLoadBalancer implements LoadBalancer<C> { List<Entry<ResolvedAddress, List<C>>> activeAddresses() { return activeHosts.stream().map(Host::asEntry).collect(toList()); } }
RoundRobinLoadBalancer implements LoadBalancer<C> { List<Entry<ResolvedAddress, List<C>>> activeAddresses() { return activeHosts.stream().map(Host::asEntry).collect(toList()); } RoundRobinLoadBalancer(final Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher,
                                  final ConnectionFactory<ResolvedAddress, ? extends C> connectionFactory); }
RoundRobinLoadBalancer implements LoadBalancer<C> { List<Entry<ResolvedAddress, List<C>>> activeAddresses() { return activeHosts.stream().map(Host::asEntry).collect(toList()); } RoundRobinLoadBalancer(final Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher,
                                  final ConnectionFactory<ResolvedAddress, ? extends C> connectionFactory); static RoundRobinLoadBalancerFactory<ResolvedAddress, C> newRoundRobinFactory(); @Override Single<C> selectConnection(Predicate<C> selector); @Override Publisher<Object> eventStream(); @Override Completable onClose(); @Override Completable closeAsync(); @Override Completable closeAsyncGracefully(); }
RoundRobinLoadBalancer implements LoadBalancer<C> { List<Entry<ResolvedAddress, List<C>>> activeAddresses() { return activeHosts.stream().map(Host::asEntry).collect(toList()); } RoundRobinLoadBalancer(final Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher,
                                  final ConnectionFactory<ResolvedAddress, ? extends C> connectionFactory); static RoundRobinLoadBalancerFactory<ResolvedAddress, C> newRoundRobinFactory(); @Override Single<C> selectConnection(Predicate<C> selector); @Override Publisher<Object> eventStream(); @Override Completable onClose(); @Override Completable closeAsync(); @Override Completable closeAsyncGracefully();  }