public abstract class AbstractRpcProxy<T> extends Object implements RpcProxy<T>, NotifyListener
| 限定符和类型 | 类和说明 |
|---|---|
static class |
AbstractRpcProxy.HeartbeatRpcInvocation |
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_REQUEST_RETRY
默认重试次数3次.
|
protected Class<T> |
interfaceClass
接口的class类型.
|
protected LoadBalance |
loadBalance
负载均衡器.
|
protected Object |
lock |
protected Registry |
registry
服务注册.
|
protected Integer |
requestTimeout
请求超时
|
protected int |
retry
请求重试次数.
|
protected RpcClientTemplate |
rpcClientTemplate |
protected RpcClientConfiguration |
rpcConfiguration |
protected List<URL> |
subscribeUrls
订阅的url.
|
protected URL |
url
当前URL.
|
| 构造器和说明 |
|---|
AbstractRpcProxy() |
| 限定符和类型 | 方法和说明 |
|---|---|
T |
createProxy(Class<T> interfaceClass,
RpcClientConfiguration conf,
boolean lazyLoadRegistry,
boolean lazyStartRpcClient)
创建代理
|
protected abstract T |
doCreateProxy()
创建代理对象
|
protected RemotingClient |
loadBalance(Request request)
执行负载均衡
|
protected void |
lookAndSubscribeUrl(URL url)
查看urls 并且订阅
|
void |
notify(List<URL> urls) |
protected Object |
retryRequest(RemotingClient rpcClient,
Request request) |
protected Registry |
startRegistry(URL registryUrl)
启动服务注册
|
void |
startRegistryIfNecessary(URL registryUrl) |
String |
toString() |
protected Request |
warpRequest(Object proxy,
Method method,
Object[] args) |
protected Registry registry
protected URL url
protected final Object lock
protected Integer requestTimeout
protected LoadBalance loadBalance
protected RpcClientConfiguration rpcConfiguration
public static final int DEFAULT_REQUEST_RETRY
protected int retry
protected RpcClientTemplate rpcClientTemplate
protected void lookAndSubscribeUrl(URL url)
url - public T createProxy(Class<T> interfaceClass, RpcClientConfiguration conf, boolean lazyLoadRegistry, boolean lazyStartRpcClient)
createProxy 在接口中 RpcProxy<T>interfaceClass - 接口classconf - 配置lazyLoadRegistry - 懒加载服务注册lazyStartRpcClient - 懒加载rpc客户端protected abstract T doCreateProxy()
public void startRegistryIfNecessary(URL registryUrl)
public void notify(List<URL> urls)
notify 在接口中 NotifyListenerprotected RemotingClient loadBalance(Request request)
request - protected Object retryRequest(RemotingClient rpcClient, Request request) throws TimeoutException
TimeoutExceptionCopyright © 2020. All rights reserved.