@Test public void testOne() { BehaviorSubject<List<Integer>> source = BehaviorSubject.create(); LoadBalancer<Integer> lb = LoadBalancer.fromSnapshotSource(source).build(ChoiceOfTwoLoadBalancer.create(COMPARATOR)); source.onNext(Lists.newArrayList(0)); for (int i = 0; i < 100; i++) { Assert.assertEquals(0, (int)lb.next()); } }
public static <T> ChoiceOfTwoLoadBalancer<T> create(final Comparator<T> func) { return new ChoiceOfTwoLoadBalancer<T>(func); }
ChoiceOfTwoLoadBalancer implements LoadBalancerStrategy<T> { public static <T> ChoiceOfTwoLoadBalancer<T> create(final Comparator<T> func) { return new ChoiceOfTwoLoadBalancer<T>(func); } }
ChoiceOfTwoLoadBalancer implements LoadBalancerStrategy<T> { public static <T> ChoiceOfTwoLoadBalancer<T> create(final Comparator<T> func) { return new ChoiceOfTwoLoadBalancer<T>(func); } ChoiceOfTwoLoadBalancer(final Comparator<T> func2); }
ChoiceOfTwoLoadBalancer implements LoadBalancerStrategy<T> { public static <T> ChoiceOfTwoLoadBalancer<T> create(final Comparator<T> func) { return new ChoiceOfTwoLoadBalancer<T>(func); } ChoiceOfTwoLoadBalancer(final Comparator<T> func2); static ChoiceOfTwoLoadBalancer<T> create(final Comparator<T> func); @Override T choose(List<T> candidates); }
ChoiceOfTwoLoadBalancer implements LoadBalancerStrategy<T> { public static <T> ChoiceOfTwoLoadBalancer<T> create(final Comparator<T> func) { return new ChoiceOfTwoLoadBalancer<T>(func); } ChoiceOfTwoLoadBalancer(final Comparator<T> func2); static ChoiceOfTwoLoadBalancer<T> create(final Comparator<T> func); @Override T choose(List<T> candidates);  }