Jagger
 All Classes Namespaces Files Functions Variables Enumerator Groups Pages
Iterator<Pair<Q, E> > com.griddynamics.jagger.invoker.SimpleCircularLoadBalancer< Q, E >.provide ( )

Returns an iterator over pairs.

Details:

Returns an iterator over pairs, which were created by pairSupplierFactory

Returns
iterator over pairs

Implements com.griddynamics.jagger.invoker.LoadBalancer< Q, E >.

Definition at line 51 of file SimpleCircularLoadBalancer.java.

51  {
52 
53  return new AbstractIterator<Pair<Q,E>> () {
54 
55  private PairSupplier<Q, E> pairs = getPairSupplier();
56  private int size = pairs.size();
57  private int index = 0;
58 
59  @Override
60  protected Pair<Q, E> computeNext() {
61  if(index >= size) {
62  index = 0;
63  }
64  return pairs.get(index++);
65  }
66 
67  @Override
68  public String toString() {
69  return "SimpleCircularLoadBalancer iterator";
70  }
71  };
72  }