public class ClientConfig<T> extends Object implements IConfigCheck
| 构造器和说明 |
|---|
ClientConfig() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
addShutdownHook(IRegistry registry,
RpcMonitor monitor,
HeartBeatManager<T> heartBeatManager)
添加关闭钩子
|
protected org.apache.commons.pool.impl.GenericKeyedObjectPool<ServerNode,T> |
bulidClientPool(ClassLoader classLoader,
Class<?> ifaceClass)
构建client对象池
|
void |
check()
检查配置
配置非法时,抛出异常 RpcException
|
T |
createProxy(RegistryConfig registryConfig)
创建代理
|
void |
destory()
销毁资源
包括:释放注册中心连接、heartbeat等资源。 |
protected String |
genConfigJson()
生成配置文件的json格式
|
String |
getAddress()
getter method
|
int |
getHeartbeat()
getter method
|
int |
getHeartbeatInterval()
getter method
|
int |
getHeartbeatTimeout()
getter method
|
int |
getHeartbeatTimes()
getter method
|
String |
getIface()
getter method
|
int |
getInterval()
getter method
|
String |
getLoadbalance()
getter method
|
int |
getMaxActive()
getter method
|
int |
getMaxIdle()
getter method
|
int |
getMaxWait()
getter method
|
int |
getMinIdle()
getter method
|
String |
getName()
getter method
|
String |
getOwner()
getter method
|
String |
getProtocol()
getter method
|
int |
getRetry()
getter method
|
String |
getService()
getter method
|
int |
getTimeBetweenEvictionRunsMillis()
getter method
|
int |
getTimeout()
getter method
|
boolean |
isMonitor()
getter method
|
boolean |
isTestWhileIdle()
getter method
|
void |
setAddress(String address)
setter method
|
void |
setHeartbeat(int heartbeat)
setter method
|
void |
setHeartbeatInterval(int heartbeatInterval)
setter method
|
void |
setHeartbeatTimeout(int heartbeatTimeout)
setter method
|
void |
setHeartbeatTimes(int heartbeatTimes)
setter method
|
void |
setIface(String iface)
setter method
|
void |
setInterval(int interval)
setter method
|
void |
setLoadbalance(String loadbalance)
setter method
|
void |
setMaxActive(int maxActive)
setter method
|
void |
setMaxIdle(int maxIdle)
setter method
|
void |
setMaxWait(int maxWait)
setter method
|
void |
setMinIdle(int minIdle)
setter method
|
void |
setMonitor(boolean monitor)
setter method
|
void |
setName(String name)
setter method
|
void |
setOwner(String owner)
setter method
|
void |
setProtocol(String protocol)
setter method
|
void |
setRetry(int retry)
setter method
|
void |
setService(String service)
setter method
|
void |
setTestWhileIdle(boolean testWhileIdle)
setter method
|
void |
setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
setter method
|
void |
setTimeout(int timeout)
setter method
|
public T createProxy(RegistryConfig registryConfig) throws Exception
registryConfig - Exceptionprotected org.apache.commons.pool.impl.GenericKeyedObjectPool<ServerNode,T> bulidClientPool(ClassLoader classLoader, Class<?> ifaceClass) throws ClassNotFoundException, InstantiationException, IllegalAccessException
classLoader - ifaceClass - ClassNotFoundExceptionInstantiationExceptionIllegalAccessExceptionpublic void check()
throws RpcException
IConfigCheckRpcException
check 在接口中 IConfigCheckRpcExceptionpublic void destory()
protected String genConfigJson()
protected void addShutdownHook(IRegistry registry, RpcMonitor monitor, HeartBeatManager<T> heartBeatManager)
registry - monitor - heartBeatManager - public void setService(String service)
service - the service to setservicepublic void setAddress(String address)
address - the address to setaddresspublic int getRetry()
retrypublic void setRetry(int retry)
retry - the retry to setretrypublic void setProtocol(String protocol)
protocol - the protocol to setprotocolpublic boolean isMonitor()
monitorpublic void setMonitor(boolean monitor)
monitor - the monitor to setmonitorpublic int getInterval()
intervalpublic void setInterval(int interval)
interval - the interval to setintervalpublic String getLoadbalance()
loadbalancepublic void setLoadbalance(String loadbalance)
loadbalance - the loadbalance to setloadbalancepublic int getTimeout()
timeoutpublic void setTimeout(int timeout)
timeout - the timeout to settimeoutpublic int getMaxActive()
maxActivepublic void setMaxActive(int maxActive)
maxActive - the maxActive to setmaxActivepublic int getMaxIdle()
maxIdlepublic void setMaxIdle(int maxIdle)
maxIdle - the maxIdle to setmaxIdlepublic int getMinIdle()
minIdlepublic void setMinIdle(int minIdle)
minIdle - the minIdle to setminIdlepublic int getMaxWait()
maxWaitpublic void setMaxWait(int maxWait)
maxWait - the maxWait to setmaxWaitpublic int getTimeBetweenEvictionRunsMillis()
timeBetweenEvictionRunsMillispublic void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
timeBetweenEvictionRunsMillis - the timeBetweenEvictionRunsMillis to settimeBetweenEvictionRunsMillispublic boolean isTestWhileIdle()
testWhileIdlepublic void setTestWhileIdle(boolean testWhileIdle)
testWhileIdle - the testWhileIdle to settestWhileIdlepublic int getHeartbeat()
heartbeatpublic void setHeartbeat(int heartbeat)
heartbeat - the heartbeat to setheartbeatpublic int getHeartbeatTimeout()
heartbeatTimeoutpublic void setHeartbeatTimeout(int heartbeatTimeout)
heartbeatTimeout - the heartbeatTimeout to setheartbeatTimeoutpublic int getHeartbeatTimes()
heartbeatTimespublic void setHeartbeatTimes(int heartbeatTimes)
heartbeatTimes - the heartbeatTimes to setheartbeatTimespublic int getHeartbeatInterval()
heartbeatIntervalpublic void setHeartbeatInterval(int heartbeatInterval)
heartbeatInterval - the heartbeatInterval to setheartbeatIntervalCopyright © 2015 Baifendian Corporation. All rights reserved.