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

Returns an iterator over pairs.

Author
Grid Dynamics
Details:

Scenario take the next pair of queries and endpoints and try to execute invocation with this data

Returns
iterator over pairs

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

31  {
32 
33  return new AbstractIterator<Pair<Q,E>> () {
34 
35  private PairSupplier<Q, E> pairs = getPairSupplier();
36  private int size = pairs.size();
37  private int index = 0;
38 
39  @Override
40  protected Pair<Q, E> computeNext() {
41  if(index >= size) {
42  index = 0;
43  }
44  return pairs.get(index++);
45  }
46 
47  @Override
48  public String toString() {
49  return "SimpleCircularLoadBalancer iterator";
50  }
51 
52 
53  };
54  }