RoundRobinRoutingState implements Router { @Override public int route(int key) { return -1; } RoundRobinRoutingState(List<Integer> opIds); @Override int route(int key); @Override int route();  }
@Test public void test() { int connections = 100; List<Integer> opIds = new ArrayList<>(); for(int i = 0; i < connections; i++){ opIds.add(i); } Router r = RouterFactory.buildRouterFor(opIds, false); int iter = 1000; for(int i = 0; i < iter; i++){ int opId = r.route(); System.out.println("route-to: "+opId); } assert(true); }
@Test public void testTime(){ int connections = 5; List<Integer> opIds = new ArrayList<>(); for(int i = 0; i < connections; i++){ opIds.add(i); } Router r = RouterFactory.buildRouterFor(opIds, false); int iter = 10000000; long start = System.nanoTime(); for(int i = 0; i < iter; i++){ int opId = r.route(); } long stop = System.nanoTime(); long totalMillis = (stop-start)/1000000; System.out.println("Time to route: "+iter+" to "+connections+" downstreams is: "+totalMillis+" ms"); assert(true); }