Skip to content
Snippets Groups Projects
Commit 372be0ec authored by Aiolos's avatar Aiolos
Browse files

weight hash version

parent 97ab5e8a
No related branches found
No related tags found
No related merge requests found
......@@ -21,9 +21,9 @@ public class UserLoadBalance implements LoadBalance {
@Override
public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
//int[] invoker_list = {0, 1, 1, 2, 2, 2};
//int id = ThreadLocalRandom.current().nextInt(invoker_list.length);
//return invokers.get(invoker_list[id]);
return invokers.get(0);
int[] invoker_list = {0, 1, 1, 2, 2, 2};
int id = ThreadLocalRandom.current().nextInt(6);
//System.out.println("Send one request to " + invoker_list[id]);
return invokers.get(invoker_list[id]);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment