public class ServerConfig extends Object implements IConfigCheck
| 构造器和说明 |
|---|
ServerConfig() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
addShutdownHook(IRegistry registry,
IServer server)
添加关闭钩子
|
void |
check()
检查配置
配置非法时,抛出异常 RpcException
|
protected IServer |
createServer(ServerNode serverNode,
RpcMonitor rpcMonitor)
创建服务
|
void |
destory()
销毁资源
包括:释放注册中心连接、停止服务。 |
void |
export(RegistryConfig registryConfig)
暴露服务
|
protected String |
genConfigJson()
生成配置文件的json格式
|
protected ServerNode |
genServerNode()
生成
ServerNode
|
int |
getInterval()
getter method
|
String |
getIp()
getter method
|
int |
getMaxWorkerThreads()
getter method
|
int |
getMinWorkerThreads()
getter method
|
String |
getName()
getter method
|
String |
getOwner()
getter method
|
int |
getPort()
getter method
|
String |
getProtocol()
getter method
|
Object |
getRef()
getter method
|
String |
getService()
getter method
|
int |
getWeight()
getter method
|
boolean |
isMonitor()
getter method
|
protected org.apache.thrift.TProcessor |
reflectProcessor(RpcMonitor rpcMonitor,
ServerNode serverNode)
反射TProcessor
|
protected Class |
reflectProtocolClass()
反射iface
|
void |
setInterval(int interval)
setter method
|
void |
setIp(String ip)
setter method
|
void |
setMaxWorkerThreads(int maxWorkerThreads)
setter method
|
void |
setMinWorkerThreads(int minWorkerThreads)
setter method
|
void |
setMonitor(boolean monitor)
setter method
|
void |
setName(String name)
setter method
|
void |
setOwner(String owner)
setter method
|
void |
setPort(int port)
setter method
|
void |
setProtocol(String protocol)
setter method
|
void |
setRef(Object ref)
setter method
|
void |
setService(String service)
setter method
|
void |
setWeight(int weight)
setter method
|
public void export(RegistryConfig registryConfig) throws ClassNotFoundException, RpcException
ClassNotFoundException - ,RpcExceptionRpcExceptionprotected IServer createServer(ServerNode serverNode, RpcMonitor rpcMonitor) throws ClassNotFoundException
serverNode - rpcMonitor - IServerClassNotFoundExceptionprotected org.apache.thrift.TProcessor reflectProcessor(RpcMonitor rpcMonitor, ServerNode serverNode)
rpcMonitor - serverNode - protected Class reflectProtocolClass()
Responderprotected ServerNode genServerNode()
ServerNode
ServerNodepublic void check()
throws RpcException
IConfigCheckRpcException
check 在接口中 IConfigCheckRpcExceptionpublic void destory()
protected String genConfigJson()
protected void addShutdownHook(IRegistry registry, IServer server)
registry - server - public int getPort()
portpublic void setPort(int port)
port - the port to setportpublic void setProtocol(String protocol)
protocol - the protocol to setprotocolpublic int getWeight()
weightpublic void setWeight(int weight)
weight - the weight to setweightpublic void setService(String service)
service - the service to setservicepublic boolean isMonitor()
monitorpublic void setMonitor(boolean monitor)
monitor - the monitor to setmonitorpublic int getInterval()
intervalpublic void setInterval(int interval)
interval - the interval to setintervalpublic int getMaxWorkerThreads()
maxWorkerThreadspublic void setMaxWorkerThreads(int maxWorkerThreads)
maxWorkerThreads - the maxWorkerThreads to setmaxWorkerThreadspublic int getMinWorkerThreads()
minWorkerThreadspublic void setMinWorkerThreads(int minWorkerThreads)
minWorkerThreads - the minWorkerThreads to setminWorkerThreadsCopyright © 2015 Baifendian Corporation. All rights reserved.