Skip to content
Snippets Groups Projects
Commit 0ed20816 authored by xujingfeng's avatar xujingfeng
Browse files

add user loadbalance extension

parent 881e8ed4
No related branches found
No related tags found
No related merge requests found
package com.aliware.tianchi;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.cluster.LoadBalance;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* @author daofeng.xjf
*/
public class UserLoadBalance implements LoadBalance {
@Override
public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
System.out.println("use user loadbalance");
return invokers.get(ThreadLocalRandom.current().nextInt(invokers.size()));
}
}
com.aliware.tianchi.UserLoadBalance
\ No newline at end of file
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