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

weight hash version

parent 8558c3b0
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,8 @@ public class UserLoadBalance implements LoadBalance {
@Override
public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
return invokers.get(ThreadLocalRandom.current().nextInt(invokers.size()));
int[] invoker_list = {0, 1, 1, 2, 2, 2};
int id = ThreadLocalRandom.current().nextInt(invoker_list.length);
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