@Test public void testWeighted() { URI uriLowWeight = URI.create("http: URI uriHighWeight = URI.create("https: httpServiceBalancer.updateHttpUris(ImmutableList.of(uriLowWeight, uriHighWeight, uriHighWeight, uriHighWeight)); consumeUri(uriHighWeight); assertThat(frequencyOfUri(uriLowWeight)).isBetween(25.0, 40.0); consumeUri(uriHighWeight); assertThat(frequencyOfUri(uriLowWeight)).isBetween(45.0, 55.0); consumeUri(uriHighWeight); assertThat(frequencyOfUri(uriLowWeight)).isEqualTo(100.0); consumeUri(uriLowWeight); assertThat(frequencyOfUri(uriLowWeight)).isBetween(20.0, 30.0); }
@Beta public void updateHttpUris(Collection<URI> newHttpUris) { httpUris.set(ImmutableMultiset.copyOf(newHttpUris)); }
HttpServiceBalancerImpl implements HttpServiceBalancer { @Beta public void updateHttpUris(Collection<URI> newHttpUris) { httpUris.set(ImmutableMultiset.copyOf(newHttpUris)); } }
HttpServiceBalancerImpl implements HttpServiceBalancer { @Beta public void updateHttpUris(Collection<URI> newHttpUris) { httpUris.set(ImmutableMultiset.copyOf(newHttpUris)); } HttpServiceBalancerImpl(String description, HttpServiceBalancerStats httpServiceBalancerStats, HttpServiceBalancerConfig config);   HttpServiceBalancerImpl(String description, HttpServiceBalancerStats httpServiceBalancerStats, HttpServiceBalancerConfig config, Ticker ticker); }
HttpServiceBalancerImpl implements HttpServiceBalancer { @Beta public void updateHttpUris(Collection<URI> newHttpUris) { httpUris.set(ImmutableMultiset.copyOf(newHttpUris)); } HttpServiceBalancerImpl(String description, HttpServiceBalancerStats httpServiceBalancerStats, HttpServiceBalancerConfig config);   HttpServiceBalancerImpl(String description, HttpServiceBalancerStats httpServiceBalancerStats, HttpServiceBalancerConfig config, Ticker ticker); @Override HttpServiceAttempt createAttempt(); @Beta void updateHttpUris(Collection<URI> newHttpUris); @Nested MaxGauge getConcurrency(); }
HttpServiceBalancerImpl implements HttpServiceBalancer { @Beta public void updateHttpUris(Collection<URI> newHttpUris) { httpUris.set(ImmutableMultiset.copyOf(newHttpUris)); } HttpServiceBalancerImpl(String description, HttpServiceBalancerStats httpServiceBalancerStats, HttpServiceBalancerConfig config);   HttpServiceBalancerImpl(String description, HttpServiceBalancerStats httpServiceBalancerStats, HttpServiceBalancerConfig config, Ticker ticker); @Override HttpServiceAttempt createAttempt(); @Beta void updateHttpUris(Collection<URI> newHttpUris); @Nested MaxGauge getConcurrency();  }